firebase-admin-node icon indicating copy to clipboard operation
firebase-admin-node copied to clipboard

Node v18 throwing credential implementation issue but not with node v16

Open rossjackson opened this issue 2 years ago • 6 comments

Describe your environment

  • Operating System version: Docker using FROM node:18.16
  • Firebase SDK version: 11.9
  • Firebase Product: auth
  • Node.js version: 18.16
  • NPM version: 9.5.1

Steps to reproduce:

When I upgraded my docker node from 16.19 to 18.16, I get this error:

credential implementation provided to initializeapp() via the "credential" property failed to fetch a valid google oauth2 access token.

However, if I downgrade it back to 16.19, the notifications get pushed out.

From the package.json it says that it can support node 14 and higher but its failing on v18 for me.

Relevant Code:

I'm using very basic:

initializeApp({
    credential: applicationDefault(),
})

rossjackson avatar Jul 04 '23 02:07 rossjackson

Operating System Version: node:18.15 Firebase SDK version: 11.9 Firebase Product: auth Node.js version: 18.15 NPM version: 9.6.2

I have the same issue in local development. I've tried all the initialization approaches recommended in Firebase docs.

Error Message: 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: connect ETIMEDOUT 2404:6800:4009:820::200d:443

Code:

var credentials = require("path/to/serviceAccountKey.json");

initializeApp({
  credential: cert(credentials),
});

kirankatarki avatar Jul 04 '23 08:07 kirankatarki

Same issue here

tux2nicolae avatar Jul 29 '23 15:07 tux2nicolae

Hey folks, I am unable to reproduce this on v18.15.0 and [email protected]. Do you only experience this issue on linux environments?

lahirumaramba avatar Aug 04 '23 17:08 lahirumaramba

Hey folks, I am unable to reproduce this on v18.15.0 and [email protected]. Do you only experience this issue on linux environments?

I haven't tested it on any other environment. I'm using mine on a docker container with node:18.16 image.

rossjackson-ma avatar Aug 04 '23 17:08 rossjackson-ma

Thanks @rossjackson-ma. Could you share a minimal repro or a minimal version of your docker file?

lahirumaramba avatar Aug 04 '23 17:08 lahirumaramba

Here is a repo you can clone. I added some README

rossjackson avatar Aug 04 '23 18:08 rossjackson