as the title says URL generated by scripts are failing at the moment of uploading via curl with the following error message:
The request signature we calculated does not match the signature you provided. Check your key and signing method.
however if I run the same steps manually in the shell it works with no issues.
also, if I take a URL generated by the script and try to do curl manually it fails.
here's the script:
#!/bin/bash
# Set the variables
AWS_ACCESS_KEY_ID=<YOUR_AWS_ACCESS_KEY_ID>
AWS_SECRET_ACCESS_KEY=<YOUR_AWS_SECRET_ACCESS_KEY>
AWS_DEFAULT_REGION=<YOUR_AWS_REGION>
PROJECT_ARN=<YOUR_DEVICE_FARM_PROJECT_ARN>
DEVICE_POOL_ARN=<YOUR_DEVICE_FARM_DEVICE_POOL_ARN>
APK_FILE_PATH=<PATH_TO_YOUR_APK_FILE>
TEST_FILE_PATH=<PATH_TO_YOUR_TEST_BUNDLE_FILE>
# Upload the APK to Device Farm
APK_UPLOAD_RESPONSE=$(aws devicefarm create-upload \
--project-arn $PROJECT_ARN \
--name $(basename $APK_FILE_PATH) \
--type ANDROID_APP \
--content-type application/octet-stream \
--query "upload.[arn, url]" \
--output text \
--region $AWS_DEFAULT_REGION \
--profile default \
)
# Upload the test bundle to Device Farm
TEST_UPLOAD_RESPONSE=$(aws devicefarm create-upload \
--project-arn $PROJECT_ARN \
--name $(basename $TEST_FILE_PATH) \
--type APPIUM_JAVA_JUNIT_TEST_PACKAGE \
--content-type application/octet-stream \
--query "upload.[arn, url]" \
--output text \
--region $AWS_DEFAULT_REGION \
--profile default \
)
# Get the upload ARNs from the responses
APK_UPLOAD_ARN=$(echo $APK_UPLOAD_RESPONSE | awk '{print $1}')
TEST_UPLOAD_ARN=$(echo $TEST_UPLOAD_RESPONSE | awk '{print $1}')
# Get the upload URLs from the responses
APK_UPLOAD_URL=$(echo $APK_UPLOAD_RESPONSE | awk '{print $2}')
TEST_UPLOAD_URL=$(echo $TEST_UPLOAD_RESPONSE | awk '{print $2}')
# Upload the APK and test bundle to S3 using curl
curl -T $APK_FILE_PATH "$APK_UPLOAD_URL"
curl -T $TEST_FILE_PATH "$TEST_UPLOAD_URL"
# Schedule a test run with Device Farm
aws devicefarm schedule-run \
--project-arn $PROJECT_ARN \
--app-arn $APK_UPLOAD_ARN \
--device-pool-arn $DEVICE_POOL_ARN \
--name "My Test Run" \
--test '{"type": "APPIUM_JAVA_JUNIT_TEST_PACKAGE", "testPackageArn": "'$TEST_UPLOAD_ARN'"}' \
--query "run.[arn]" \
--output text \
--region $AWS_DEFAULT_REGION \
--profile default \