So, I was struggling to get emulators to run locally due to GOOGLE_APPLICATION_CREDENTIALS being falsely set. So I installed dotenv in my functions folder and set my credentials path in .env.local.
but now, as I’m deploying I’m getting this weird error:
Not completely sure but it seems to be
DEFAULT 2024-09-17T14:43:28.462337Z Detailed stack trace: Error: Failed to read credentials from file /Users/felixhausler/Documents/CompanyCreator.nosync/companybuilder/cred/companybuilder-ab685-4f14282a87c8.json: Error: ENOENT: no such file or directory, open ‘/Users/felixhausler/Documents/CompanyCreator.nosync/companybuilder/cred/companybuilder-ab685-4f14282a87c8.json’
Here’s the whole log output for one of the cloud functions
ERROR 2024-09-17T14:43:28.731678Z [protoPayload.serviceName: run.googleapis.com] [protoPayload.methodName: /InternalServices.ReplaceInternalService] [protoPayload.resourceName: namespaces/companybuilder-ab685/revisions/external-apis-addressautocomplete-00016-bov] Ready condition status changed to False for Revision external-apis-addressautocomplete-00016-bov with message: The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information. Logs URL: https://console.cloud.google.com/logs/viewer?project=companybuilder-ab685&resource=cloud_run_revision/service_name/external-apis-addressautocomplete/revision_name/external-apis-addressautocomplete-00016-bov&advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22external-apis-addressautocomplete%22%0Aresource.labels.revision_name%3D%22external-apis-addressautocomplete-00016-bov%22 For more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start ERROR 2024-09-17T14:43:28.719053Z Default STARTUP TCP probe failed 1 time consecutively for container “worker” on port 8080. The instance was not started. WARNING 2024-09-17T14:43:28.635063078Z Container called exit(1). DEFAULT 2024-09-17T14:43:28.462763Z Could not load the function, shutting down. DEFAULT 2024-09-17T14:43:28.462375Z at Module.require (node:internal/modules/cjs/loader:1231:19) DEFAULT 2024-09-17T14:43:28.462372Z at Module._load (node:internal/modules/cjs/loader:1019:12) DEFAULT 2024-09-17T14:43:28.462369Z at Module.load (node:internal/modules/cjs/loader:1203:32) DEFAULT 2024-09-17T14:43:28.462365Z at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) DEFAULT 2024-09-17T14:43:28.462361Z at Module._compile (node:internal/modules/cjs/loader:1364:14) DEFAULT 2024-09-17T14:43:28.462358Z at Object. (/workspace/index.js:4:32) DEFAULT 2024-09-17T14:43:28.462354Z at Object.applicationDefault (/layers/google.nodejs.yarn/yarn_modules/node_modules/firebase-admin/lib/app/credential-factory.js:55:80) DEFAULT 2024-09-17T14:43:28.462350Z at getApplicationDefault (/layers/google.nodejs.yarn/yarn_modules/node_modules/firebase-admin/lib/app/credential-internal.js:401:16) DEFAULT 2024-09-17T14:43:28.462346Z at credentialFromFile (/layers/google.nodejs.yarn/yarn_modules/node_modules/firebase-admin/lib/app/credential-internal.js:480:29) DEFAULT 2024-09-17T14:43:28.462342Z at readCredentialFile (/layers/google.nodejs.yarn/yarn_modules/node_modules/firebase-admin/lib/app/credential-internal.js:507:15) DEFAULT 2024-09-17T14:43:28.462337Z Detailed stack trace: Error: Failed to read credentials from file /Users/felixhausler/Documents/CompanyCreator.nosync/companybuilder/cred/companybuilder-ab685-4f14282a87c8.json: Error: ENOENT: no such file or directory, open ‘/Users/felixhausler/Documents/CompanyCreator.nosync/companybuilder/cred/companybuilder-ab685-4f14282a87c8.json’ DEFAULT 2024-09-17T14:43:28.462315Z Is there a syntax error in your code? DEFAULT 2024-09-17T14:43:28.462291Z Provided module can’t be loaded.
I tried following the docs (https://firebase.google.com/docs/functions/local-emulator#instrument_your_app_to_talk_to_the_emulators) but without success thus far. How do I reset GOOGLE_APPLICATION_CREDENTIALS on the server to make my cloud functions work again?
1