简体   繁体   中英

AWS Device Farm - Failed upload when using the CLI

I am trying to upload an apk to device farm using a bash script, I have used the create-upload endpoint to get a pre-signed url for the put request, and then I am using curl to PUT the apk to the end point.

RESPONSE=$(aws devicefarm create-upload --project-arn %deviceFarmProjectARN% --name platforms/android/build/outputs/apk/android-release-unsigned.apk --type ANDROID_APP --content-type application/octet-stream)  
APK_ARN=$(echo "$RESPONSE" | grep arn:aws:devicefarm | gawk 'match($0, "(arn:aws:devicefarm(.*))\"", ary) {print ary[1]}')
APK_PUT_URL=$(echo "$RESPONSE" | gawk 'match($0, "\"url\": \"(.*)\"", ary) {print ary[1]}')
echo "$APK_ARN" >> apkARN.txt
curl $APK_PUT_URL -X PUT --upload-file platforms/android/build/outputs/apk/android-release-unsigned.apk -H "Content-Type:application/octet-stream"

The file upload seems to work, but when I check the status using the returned ARN the status is failed, and the reason is "Invalid application uploaded"

"upload": {
        "status": "FAILED", 
        "contentType": "application/octet-stream", 
        "name": "platforms/android/build/outputs/apk/android-release-unsigned.apk", 
        "created": 1437582538.139, 
        "type": "ANDROID_APP", 
        "arn": "arn:aws:devicefarm:us-west-2:208791684493:upload:a9153182-8e03-4bc3-a5db-bc02034f1331/190ac7a5-bdc4-46f2-aac2-46bb994f2cf3", 
        "metadata": "{\"errorMessage\":\"Invalid application uploaded.\"}"
    }

However when I upload exactly the same file through the GUI, on the web console, the application is fine, and I can run tests against it.

the upload name only accepts word characters. The upload is failing because of the forward slashes in the name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM