4

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               |
+---+---------------------------------------------------------------+----------+
bshears
  • 1,119
  • 9
  • 18

2 Answers2

2

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

kip2
  • 6,473
  • 4
  • 55
  • 72
  • 1
    In my case that was an issue. Totally forgot to mention about that, sorry. Thanks @kip2 – bshears Jul 18 '20 at 12:19
  • Hey! what's the `File Storage ID`? from where should I got it? – Oliver D Oct 03 '21 at 08:47
  • @OliverD I'm not sure about that. Since it's been more than a year, it's possible that Bitrise has changed their UI so perhaps create a separate question and/or get in touch with their support team? FWIW, I saw this doc that mentions 'File Storage ID': https://devcenter.bitrise.io/tutorials/how-to-use-the-generic-file-storage/ – kip2 Oct 04 '21 at 09:41
1

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.

jobbert
  • 3,297
  • 27
  • 43