admin管理员组文章数量:1309980
So I have a website written using Astro that collects stamps. It has an API written in React that will read from the Firebase DB. When I ran it locally, it works just fine. But when I hosted it to Vercel, an error pops up:
Error fetching stamps: Error: Unable to detect a Project Id in the current environment.
To learn more about authentication and Google APIs, visit:
at GoogleAuth.findAndCacheProjectId (/var/task/node_modules/.pnpm/[email protected]/node_modules/google-auth-library/build/src/auth/googleauth.js:170:19)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Firestore.initializeIfNeeded (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/index.js:1197:35)
at async Module.GET (file:///var/task/dist/server/pages/api/stamp.astro.mjs:98:21)
at async renderEndpoint (file:///var/task/dist/server/chunks/astro/server_T2yNNXBH.mjs:441:18)
at async lastNext (file:///var/task/dist/server/chunks/entrypoint_BdQR0ZKK.mjs:3116:23)
at async callMiddleware (file:///var/task/dist/server/chunks/entrypoint_BdQR0ZKK.mjs:1147:10)
at async RenderContext.render (file:///var/task/dist/server/chunks/entrypoint_BdQR0ZKK.mjs:3160:22)
at async NodeApp.render (file:///var/task/dist/server/chunks/entrypoint_BdQR0ZKK.mjs:3834:18)
at async Server.handler (file:///var/task/dist/server/chunks/entrypoint_BdQR0ZKK.mjs:13675:29)
Caused by: Error
at /var/task/node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/index.js:1040:27
at /var/task/node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/telemetry/enabled-trace-util.js:110:30
at NoopContextManager.with (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js:25:19)
at ContextAPI.with (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/build/src/api/context.js:60:46)
at NoopTracer.startActiveSpan (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js:65:31)
at ProxyTracer.startActiveSpan (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js:36:24)
at EnabledTraceUtil.startActiveSpan (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/telemetry/enabled-trace-util.js:102:28)
at Firestore.getAll (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/index.js:1031:32)
at /var/task/node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/reference/document-reference.js:182:36
at /var/task/node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/firestore/build/src/telemetry/enabled-trace-util.js:110:30
I've tried changing the environment variables on Vercel already and the same thing still happens. So I'm not sure what is wrong and how I should attempt to fix it.
Below here is the example of my .env
file:
FIREBASE_PRIVATE_KEY_ID=YOUR_PRIVATE_KEY_ID
FIREBASE_PRIVATE_KEY=YOUR_PRIVATE_KEY
FIREBASE_PROJECT_ID=YOUR_PROJECT_ID
FIREBASE_CLIENT_EMAIL=YOUR_CLIENT_EMAIL
FIREBASE_CLIENT_ID=YOUR_CLIENT_ID
FIREBASE_AUTH_URI=YOUR_AUTH_URI
FIREBASE_TOKEN_URI=YOUR_TOKEN_URI
FIREBASE_AUTH_CERT_URL=YOUR_AUTH_CERT_URL
FIREBASE_CLIENT_CERT_URL=YOUR_CLIENT_CERT_URL
API_KEY=YOUR_API_KEY
AUTH_DOMAIN=YOUR_AUTH_DOMAIN
PROJECT_ID=YOUR_PROJECT_ID
STORAGE_BUCKET=YOUR_STORAGE_BUCKET
MESSAGING_SENDER_ID=YOUR_MESSAGING_SENDER_ID
APP_ID=YOUR_APP_ID
MEASUREMENT_ID=YOUR_MEASUREMENT_ID
If there is anything more to add please tell me. Thanks for the help.
本文标签:
版权声明:本文标题:reactjs - Vercel keeps saying that it is "Unable to detect a Project Id in the current environment" even when 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741845878a2400777.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论