Firebase-admin-node: Module not found: Error: Can't resolve 'child_process' in 'C:\......\node_modules\google-auth-library\build\src\auth

Created on 11 Jun 2020  路  4Comments  路  Source: firebase/firebase-admin-node

recently I'm working with firebase-admin and I encounter an issue related to google auth( i think the issue is related to firebase admin) :

My block of code which cause error:

// idToken comes from the client app
    admin.auth().verifyIdToken(idToken)
    .then(function(decodedToken) {
      let uid = decodedToken.uid;
    }).catch(function(error) {
      console.log(error);
    });

errors are:

ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js
Module not found: Error: Can't resolve 'child_process' in 'C:\...\node_modules\google-auth-library\build\src\auth'
ERROR in ./node_modules/@grpc/grpc-js/build/src/resolver-dns.js
Module not found: Error: Can't resolve 'dns' in 'C:\....\node_modules\@grpc\grpc-js\build\src'
ERROR in ./node_modules/@google-cloud/storage/build/src/file.js
Module not found: Error: Can't resolve 'fs' in 'C:\....\node_modules\@google-cloud\storage\build\src'
ERROR in ./node_modules/@google-cloud/storage/build/src/bucket.js
Module not found: Error: Can't resolve 'fs' in 'C:\....\node_modules\@google-cloud\storage\build\src'
ERROR in ./node_modules/@grpc/grpc-js/build/src/tls-helpers.js
Module not found: Error: Can't resolve 'fs' in 'C:\....\node_modules\@grpc\grpc-js\build\src'
ERROR in ./node_modules/configstore/node_modules/make-dir/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\....\node_modules\configstore\node_modules\make-dir'
ERROR in ./node_modules/firebase-admin/lib/firebase-namespace.js
Module not found: Error: Can't resolve 'fs' in 'C:\....\node_modules\firebase-admin\lib'
ERROR in ./node_modules/firebase-admin/lib/auth/credential.js
Module not found: Error: Can't resolve 'fs' in 'C:\...\node_modules\firebase-admin\lib\auth'
ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js
Module not found: Error: Can't resolve 'fs' in 'C:\...\node_modules\google-auth-library\build\src\auth'
ERROR in ./node_modules/google-p12-pem/build/src/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\...\node_modules\google-p12-pem\build\src'
ERROR in ./node_modules/graceful-fs/graceful-fs.js
Module not found: Error: Can't resolve 'fs' in 'C:\...\node_modules\graceful-fs'
ERROR in ./node_modules/gtoken/build/src/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\...\node_modules\gtoken\build\src'
ERROR in ./node_modules/request/lib/har.js
Module not found: Error: Can't resolve 'fs' in 'C:\....\node_modules\request\lib'
ERROR in ./node_modules/write-file-atomic/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\...\node_modules\write-file-atomic'
ERROR in ./node_modules/@grpc/grpc-js/build/src/server.js
Module not found: Error: Can't resolve 'http2' in 'C:\....\node_modules\@grpc\grpc-js\build\src'
ERROR in ./node_modules/@grpc/grpc-js/build/src/subchannel.js
Module not found: Error: Can't resolve 'http2' in 'C:\....\node_modules\@grpc\grpc-js\build\src'
ERROR in ./node_modules/@grpc/grpc-js/build/src/server-call.js
Module not found: Error: Can't resolve 'http2' in 'C:\...\node_modules\@grpc\grpc-js\build\src'
ERROR in ./node_modules/@grpc/grpc-js/build/src/call-stream.js
Module not found: Error: Can't resolve 'http2' in 'C:\...\node_modules\@grpc\grpc-js\build\src'
ERROR in ./node_modules/@grpc/grpc-js/build/src/subchannel.js
Module not found: Error: Can't resolve 'net' in 'C:\...\node_modules\@grpc\grpc-js\build\src'
ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'net' in 'C:\....\node_modules\forever-agent'
ERROR in ./node_modules/https-proxy-agent/dist/agent.js
Module not found: Error: Can't resolve 'net' in 'C:\.....\node_modules\https-proxy-agent\dist'
ERROR in ./node_modules/teeny-request/node_modules/http-proxy-agent/dist/agent.js
Module not found: Error: Can't resolve 'net' in 'C:\.....\node_modules\teeny-request\node_modules\http-proxy-agent\dist'
ERROR in ./node_modules/tough-cookie/lib/cookie.js
Module not found: Error: Can't resolve 'net' in 'C:\...\node_modules\tough-cookie\lib'
ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'net' in 'C:\....\node_modules\tunnel-agent'
ERROR in ./node_modules/@grpc/grpc-js/build/src/subchannel.js
Module not found: Error: Can't resolve 'tls' in 'C:\....\node_modules\@grpc\grpc-js\build\src'
ERROR in ./node_modules/@grpc/grpc-js/build/src/channel-credentials.js
Module not found: Error: Can't resolve 'tls' in 'C:\....\node_modules\@grpc\grpc-js\build\src'
ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'C:\....\node_modules\forever-agent'
ERROR in ./node_modules/https-proxy-agent/dist/agent.js
Module not found: Error: Can't resolve 'tls' in 'C:\....\node_modules\https-proxy-agent\dist'
ERROR in ./node_modules/teeny-request/node_modules/http-proxy-agent/dist/agent.js
Module not found: Error: Can't resolve 'tls' in 'C:\....\node_modules\teeny-request\node_modules\http-proxy-agent\dist'
ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'C:\....\node_modules\tunnel-agent'

Angular CLI: 9.0.2
Node: 12.16.1
OS: win32 x64 Window 10

packages:

@angular-devkit/architect 0.900.2
@angular-devkit/build-angular 0.900.2
@angular-devkit/build-optimizer 0.900.2
@angular-devkit/build-webpack 0.900.2
@angular-devkit/core 9.0.2
@angular-devkit/schematics 9.0.2
@angular/cdk 9.0.0
@angular/cli 9.0.2
@angular/fire 6.0.0
@angular/http 7.2.16
@angular/material 9.0.0
@ngtools/webpack 9.0.2
@schematics/angular 9.0.2
@schematics/update 0.900.2
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2

as I experienced issue is something related to webpack or google-auth but I don't what is the actual issue.

i alreday check this issue but not got any solution.

I'm new in angular if I did some mistake please correct me.

needs-triage

Most helpful comment

You can't use the Admin SDK on client-side web frameworks like Angular. It's only for server-side use.

All 4 comments

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

You can't use the Admin SDK on client-side web frameworks like Angular. It's only for server-side use.

Hey @hiranya911 thank you for your response. I just want to know that is there any way ( in the client-side like angular) to refresh the firebase id token which got expired after 1 hour. I'm using firebase login.
If yes can you please give me some hint or any link would be appreciated.

If you're using Firebase client SDKs to authenticate users, they handle automatic refreshing of the ID tokens to keep the auth session alive.

Was this page helpful?
0 / 5 - 0 ratings