Skip to content

Unable to parse JSON uploading apk #134

Description

@rvanderlinden

Hi,

I'm trying to use this action in a reusable workflow to upload an apk to Firebase App Distribution. Unfortunately I keep getting an issue.

The error (if I set debug: true there is no additional output):

i  uploading binary...

Error: failed to upload release. Unable to parse JSON: SyntaxError: Unexpected token < in JSON at position 0

The action in use:

      - name: Deploy to Firebase App Distribution.
        uses: wzieba/Firebase-Distribution-Github-Action@v1
        with:
          # The app ID in format 1:123:android:123abc123abc123 as taken from Firebase under Your Apps.
          appId: ${{ secrets.ANDROID_FIREBASE_APP_ID }}
          # The copied content of the private JSON key associated with the Service Account in the Google Cloud Console for this project, that has the Firebase App Distribution Admin role.
          serviceCredentialsFileContent: ${{ secrets.ANDROID_FIREBASE_SERVICE_ACCOUNT_JSON }}
          # Our test groups
          groups: "test"
          # The artifact to upload, which definitely exists (tested and working for App Center distribution).
          file: "builds/app-production-release.apk"

Considering the error is related to parsing JSON and the serviceCredentialsFileContent is the only JSON submitted by me, I validated the service account, the key and the secrets. I have a similar setup for Play Store distribution (with a private JSON key) that is working so I'm unsure what I'd be doing wrong here.

That brings me to my question: Is there any way I could get more information about the cause of the problem? I feel like the error Unexpected token < in JSON at position 0 is not related to the serviceCredentialsFileContent, but I need more feedback to validate that. Any ideas how I can move forward? Thanks!

Edit: I noticed on another issue that this error may be related to a very large apk, which is not the case here (about 10 MB).

Full workflow:

on:
  workflow_call:

   # inputs redacted for brevity

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: ${{ inputs.github-environment }}
    steps:

      - name: Fetch project from remote.
        uses: actions/checkout@v4

      - name: Download artifact '${{ inputs.app-artifact-download-filename }}'.
        uses: actions/download-artifact@v4
        with:
          name: ${{ inputs.app-artifact-download-filename }}
          path: ./builds

      - name: Deploy to Firebase App Distribution.
        uses: wzieba/Firebase-Distribution-Github-Action@v1
        with:
          appId: ${{ secrets.ANDROID_FIREBASE_APP_ID }}
          serviceCredentialsFileContent: ${{ secrets.ANDROID_FIREBASE_SERVICE_ACCOUNT_JSON }}
          groups: "test"
          file: "./builds/app-production-release.apk"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions