Skip to content

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

Closed
@wwwy3y3

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?

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