Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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               |
+---+---------------------------------------------------------------+----------+
like image 523
bshears Avatar asked Sep 12 '25 22:09

bshears


2 Answers

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

like image 175
kip2 Avatar answered Sep 15 '25 13:09

kip2


Pro tip if @kip2's answer doesn't work: Try an intended wrong path, to first verify if the same error occurs.

If this is not the problem? Create a new Service Account and grant the right access to it. For us it went wrong in this line:

Fill out the Service account user role and Service account admins role fields of the Grant users access to this service account

Because we migrated from Fastlane to Bitrise, and Fastlane doesn't require the permission Service account admins (I don't know why Bitrise does).

Then grant access in the play store again and give the account admin permission so you make sure there is nothing wrong within the permission config as well.

like image 24
jobbert Avatar answered Sep 15 '25 11:09

jobbert