firebase-admin-node: Auth error:FetchError: request to https://www.googleapis.com/oauth2/v4/token failed, reason: socket hang up

Describe your environment

  • Library version: “firebase”: “5.7.0”, “firebase-admin”: “5.13.1”,
  • Firebase Product: database

Describe the problem

I am running a server in production and regularly I have this error:

7|single   | [2019-05-26T07:16:19.801Z]  @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: \"socket hang up\"."} 
7|single   | Auth error:FetchError: request to https://www.googleapis.com/oauth2/v4/token failed, reason: socket hang up

This error happens randomly (~1 week or ~2 weeks after the server has started) and when it’s happen, I have to restart the server.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 5
  • Comments: 21 (6 by maintainers)

Most upvoted comments

@dweekly please any update from the support about the issue?

We are also seeing this issue in our project.

Has there been any new developments with this issue? I’m running “firebase-admin” version 7.4.0, and as mentioned in the OP, when running on our remote servers I’m seeing the following error:

‘Error Credential implementation provided to initializeApp() via the “credential” property failed to fetch a valid Google OAuth2 access token with the following error: “Error fetching access token: Error while making request: Client network socket disconnected before secure TLS connection was established. Error code: ECONNRESET”.’

When checking the logs, I can see that the SDK tried to reconnect 4 times, but was not successful.

If anybody’s seeing this error frequently, please file a support request at https://firebase.google.com/support. And please provide more information than provided here (exact environment, Node.js version, SDK version, example code, and ideally a debug log).

Thanks, @hiranya911 - I’ve filed Case 00018754 with details.