Skip to content

Failed to parse access token response: Error: Server responded with status 400 #435

Closed

Description

@wwwy3y3

Describe your environment

  • Operating System version: debian (from node:carbon docker image)
  • Firebase SDK version: 6.4.0
  • Library version: 6.4.0
  • Firebase Product: database

Describe the problem

On my instance, I have multiple credentials downloaded from dashboard and use them to host multiple firebase apps.

// credential changes for different apps
// credential is directly downloaded from dashboard
const projectId = credential.project_id;
const databaseURL = `https://${projectId}.firebaseio.com`;
let firebaseApp;
try {
      firebaseApp = firebaseAdmin.app(projectId);
} catch (e) {
      firebaseApp = firebaseAdmin.initializeApp({
        credential: firebaseAdmin.credential.cert(credential),
        databaseURL
      }, projectId);
}

// use firebaseApp to request then
const database = firebaseApp.database();

While some apps work fiine, some apps will throw warning below:

@firebase/database: FIREBASE WARNING: {\"code\":\"app/invalid-credential\",\"message\":\"Credential implementation provided to initializeApp() via the \\\"credential\\\" property failed to fetch a valid Google OAuth2 access token with the following error: \\\"Failed to parse access token response: Error: Server responded with status 400.\\\".\"}

And my requests to firebase just hang, no errors thrown, and my requests will be timed out.

Steps to reproduce:

It works on my local machine with firebase-admin, and it seems to only happen on certain apps. Since no errors actually thrown, it's really hard to debug with only 400 status response. Perhaps you guys have experienced this kind of error before and might be able to help me?

Activity

  1. gabimoncha commented on Jan 8, 2019

    @gabimoncha

    Hello, I encountered this issue also, just opened one without realising you already had one. My scripts throws the exact same error only on Windows. On Mac there is no problem. I will test it now on Ubuntu and see...

  2. hiranya911 commented on Jan 8, 2019

    @hiranya911
    Contributor

    See my comment on #436.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions