Github Actions: Unexpected token e in JSON at position 0

Viewed 575

i am using Github Actions to automate releases of my app to Play Store. The deployment step uses r0adkll/upload-google-play@v1.

The step is configured as follows:

  - name: Deploy to internal test track
    uses: r0adkll/upload-google-play@v1
    with:
      serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_SERVICE_ACCOUNT }}
      packageName: com.android.myapp
      releaseFiles: app/build/outputs/bundle/release/*.aab
      track: internal

The action fails with the error: Unexpected token e in JSON at position 0 which I assume is from the attempt to parse the service-account.json file saved in base64 format in secrets.

The original file contains valid json and ideally shouldn't contain any errors. What could be causing this behaviour?

2 Answers

Try to save decode base64 and save in file location then give serviceAccountJsonPlainText file location like example code.

serviceAccountJsonPlainText: file_path/google_service_account.json

In the end, my implementation worked when I saved the service-account.json file in plain text instead of base64 encoded format.

Related