You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Occasionally in prod, I get this error in my next js API route: error Error: next-firebase-auth must be initialized before rendering. at l (/var/task/node_modules/next-firebase-auth/build/index.node.js:2:9348) at /var/task/node_modules/next-firebase-auth/build/index.node.js:2:17669 at /var/task/node_modules/next-firebase-auth/build/index.node.js:2:16230 at Object.next (/var/task/node_modules/next-firebase-auth/build/index.node.js:2:16335) at /var/task/node_modules/next-firebase-auth/build/index.node.js:2:15250 at new Promise (<anonymous>) at u (/var/task/node_modules/next-firebase-auth/build/index.node.js:2:14995) at g (/var/task/node_modules/next-firebase-auth/build/index.node.js:2:17525) at applyPromoCode (/var/task/.next/server/pages/api/stripe/coupons/apply-promo.js:1:1186) at /var/task/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16498
Iam calling init auth in my _app so I don't know why it wouldn't work. It happens in this part of my logic const token = req.headers.authorization?.split(" ")[1] || "" try { if (token) { const decodedToken = await verifyIdToken(token) const { id } = decodedToken if (!id || id !== user?.id) { throw new Error("Invalid token") } }
I suspect this is a duplicate of #614. Please try initializing the Firebase JS SDK yourself prior to initializing next-firebase-auth. Let me know if the problem persists after that.
Describe the bug
Occasionally in prod, I get this error in my next js API route:
error Error: next-firebase-auth must be initialized before rendering. at l (/var/task/node_modules/next-firebase-auth/build/index.node.js:2:9348) at /var/task/node_modules/next-firebase-auth/build/index.node.js:2:17669 at /var/task/node_modules/next-firebase-auth/build/index.node.js:2:16230 at Object.next (/var/task/node_modules/next-firebase-auth/build/index.node.js:2:16335) at /var/task/node_modules/next-firebase-auth/build/index.node.js:2:15250 at new Promise (<anonymous>) at u (/var/task/node_modules/next-firebase-auth/build/index.node.js:2:14995) at g (/var/task/node_modules/next-firebase-auth/build/index.node.js:2:17525) at applyPromoCode (/var/task/.next/server/pages/api/stripe/coupons/apply-promo.js:1:1186) at /var/task/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16498
Iam calling init auth in my _app so I don't know why it wouldn't work. It happens in this part of my logic
const token = req.headers.authorization?.split(" ")[1] || "" try { if (token) { const decodedToken = await verifyIdToken(token) const { id } = decodedToken if (!id || id !== user?.id) { throw new Error("Invalid token") } }
Versions
next-firebase-auth
version: 1.0.0-beta1Firebase JS SDK (
firebase
): 10.0.0Firebase admin SDK (
firebase-admin
): 11.9.0Next.js: pages, 13.5.3
To Reproduce
Cannot figure out how to reproduce it. I am calling init auth in _app.
Expected behavior
A clear and concise description of what you expected to happen.
The text was updated successfully, but these errors were encountered: