Search code examples
androidgoogle-playbitrise

Bitrise google play deploy Failed to perform edit insert call, error: Post https://www.googleapis.com/androidpublisher/v3/applications/


I've been trying this tutorial of deployment to google play with bitrise (https://www.bitrise.io/integrations/steps/google-play-deploy) but with no success.

At some point I'm getting an error Failed to perform edit insert call, error: Post https://www.googleapis.com/androidpublisher/v3/applications/org.aacctt.[REDACTED]/edits?alt=json&prettyPrint=false: metadata: GCE metadata "instance/service-accounts/default/token?scopes=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fandroidpublisher" not defined

Already tried to find issue with token scopes, but didn't find nothing useful. Any idea what might be wrong?

Fragment of logs:

+------------------------------------------------------------------------------+

| (9) google-play-deploy@3                                                     |
+------------------------------------------------------------------------------+
| id: google-play-deploy                                                       |
| version: 3.0.2                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2020-05-04T17:39:34Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
Getting configuration
Configs:
- JSONKeyPath: *****
- PackageName: org.aacctt.[REDACTED]
- AppPath: /bitrise/deploy/app-release-bitrise-signed.apk\n
- ExpansionfilePath: 
- Track: internal
- UserFraction: 0
- WhatsnewsDir: 
- MappingFile: 
Found .apk file: /bitrise/deploy/app-release-bitrise-signed.apk
Configuration read successfully
Authenticating
Authenticated client created
Create new edit
Failed to perform edit insert call, error: Post https://www.googleapis.com/androidpublisher/v3/applications/org.aacctt.[REDACTED]/edits?alt=json&prettyPrint=false: metadata: GCE metadata "instance/service-accounts/default/token?scopes=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fandroidpublisher" not defined
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | google-play-deploy@3 (exit code: 1)                           | 12.45 sec|
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/bitrise-io/steps-google-play-deploy/issues |
| Source: https://github.com/bitrise-io/steps-google-play-deploy               |
+---+---------------------------------------------------------------+----------+

Solution

  • I also experienced this error, and it turns out that for my case, I had not set the correct path of the Play Store service account key file path. The service account is required to authenticate Bitrise into the Play Store console.

    The solution was to set the value of the BITRISE_DEPLOYER_SERVICE_ACCT_KEY env var into a valid URL containing your json file. One way is to upload the account key into Bitrise directly (onto the Generic File Storage area under the Code Signing tab) and reference the resulting URL on the 'Deploy to Google Play' step of your workflow.

    I suppose you can also store the json file in a secure environment like GCS and set the env var to the file URL

    enter image description here