googleapis / google-auth-library-nodejs

šŸ”‘ Google Auth Library for Node.js
Apache License 2.0
1.73k stars 381 forks source link

TypeError: gpcMetadata.universe is not a function with 9.3.0 after upgrade from 9.2.0 (with google-gax) on cloud run #1702

Closed mccare closed 11 months ago

mccare commented 11 months ago

Environment details

Steps to reproduce

Launching with google-gax 4.0.5 on google cloud run, the upgrade from 9.2.0 to 9.3.0 produces this new exception:

TypeError: gcpMetadata.universe is not a function
    at GoogleAuth._GoogleAuth_getUniverseFromMetadataServer (/usr/src/app/node_modules/.pnpm/google-auth-library@9.3.0/node_modules/google-auth-library/build/src/auth/googleauth.js:777:44)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async GoogleAuth.getUniverseDomain (/usr/src/app/node_modules/.pnpm/google-auth-library@9.3.0/node_modules/google-auth-library/build/src/auth/googleauth.js:186:168)
    at async GoogleAuth.getApplicationDefaultAsync (/usr/src/app/node_modules/.pnpm/google-auth-library@9.3.0/node_modules/google-auth-library/build/src/auth/googleauth.js:252:42)
    at async GoogleAuth.getClient (/usr/src/app/node_modules/.pnpm/google-auth-library@9.3.0/node_modules/google-auth-library/build/src/auth/googleauth.js:674:17)
    at async GrpcClient._getCredentials (/usr/src/app/node_modules/.pnpm/google-gax@4.0.5/node_modules/google-gax/build/src/grpc.js:145:24)
    at async GrpcClient.createStub (/usr/src/app/node_modules/.pnpm/google-gax@4.0.5/node_modules/google-gax/build/src/grpc.js:308:23)
rbrady98 commented 11 months ago

Also experiencing this error in a dev environment šŸ‘

IchordeDionysos commented 9 months ago

@danielbankhead this or a similar issue seems to be spread into other NodeJS libraries: https://github.com/googleapis/nodejs-pubsub/issues/1884

What are the recommended steps to fix it?

danielbankhead commented 9 months ago

@IchordeDionysos could you double-check npm ls google-auth-library? All 9.x versions should be on 9.6.3. If not, an rm -rf node_modules package-lock.json && npm i should resolve.

IchordeDionysos commented 9 months ago

All of them were 9.2.0. For me running yarn upgrade worked šŸ™Œ