-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: "pkcs8" must be PKCS#8 formatted string on /api/login in Vercel logs #246
Comments
@awinogrodzki Any ideas as to what might be happening? If I bypass your library, I can sign in with Firebase just fine - it's only when it's going through your middleware that I get the errors. |
Hey @michael5r! Thanks for reporting! This error usually happens when incorrect private key is provided. Could you inspect the value you pass as |
No worries! This is pretty common case, so probably I should re-throw this error with more user-friendly message. I will work on this soon :-) |
More descriptive error message released in |
# [1.7.0](v1.6.2...v1.7.0) (2024-09-09) ### Bug Fixes * add debug logs for experimental feature ([41ef1df](41ef1df)) * **#242:** use TextEncoder when mapping token to UInt8Array ([23b04dc](23b04dc)), closes [#242](#242) * **#246:** re-throw invalid PKCS8 error as AuthError with user-friendly message ([a7d7a22](a7d7a22)), closes [#246](#246) * **#249:** merge error stack trace in token verifier to improve visibility on fetch errors ([6bce756](6bce756)), closes [#249](#249) * add missing name property to decoded id token type ([39b086d](39b086d)) * pass cookie serialization options to cookie setter ([b28ce7a](b28ce7a)) * recreate canary tags after force push ([c9b7c18](c9b7c18)) * semantic-release rate exceeded error ([676b602](676b602)) * semantic-version git history issue ([d514f57](d514f57)) * update next.js peer dependency to rc ([f2953fd](f2953fd)) ### Features * **middleware:** introduced `redirectToPath` method and RegExp support in `redirectToLogin` method ([21024bb](21024bb)) * added `path` option to `redirectToHome` helper function ([54f07f4](54f07f4)) * allow setAuthCookies to accept custom auth headers or fall back ([b1d169b](b1d169b)) * experimental option to refresh token on expired kid header ([2869531](2869531)) * introduced `refreshCookiesWithIdToken` function to enable login using Server Actions ([#212](#212)) ([6cd0b13](6cd0b13)) * next.js 15 rc support ([a994dd0](a994dd0)) * pass custom auth header from authMiddleware ([71286af](71286af)) * **getTokens:** introduced optional `cookieSerializeOptions` option ([e041542](e041542)) * replaced no matching kid auth error with invalid token error ([9d2d0fc](9d2d0fc)) * support Node.js 22 ([6c7f435](6c7f435))
# [1.7.0-canary.11](awinogrodzki/next-firebase-auth-edge@v1.7.0-canary.10...v1.7.0-canary.11) (2024-08-30) ### Bug Fixes * **#246:** re-throw invalid PKCS8 error as AuthError with user-friendly message ([a7d7a22](awinogrodzki/next-firebase-auth-edge@a7d7a22)), closes [#246](awinogrodzki/next-firebase-auth-edge#246)
# [1.7.0](awinogrodzki/next-firebase-auth-edge@v1.6.2...v1.7.0) (2024-09-09) ### Bug Fixes * add debug logs for experimental feature ([41ef1df](awinogrodzki/next-firebase-auth-edge@41ef1df)) * **#242:** use TextEncoder when mapping token to UInt8Array ([23b04dc](awinogrodzki/next-firebase-auth-edge@23b04dc)), closes [#242](awinogrodzki/next-firebase-auth-edge#242) * **#246:** re-throw invalid PKCS8 error as AuthError with user-friendly message ([a7d7a22](awinogrodzki/next-firebase-auth-edge@a7d7a22)), closes [#246](awinogrodzki/next-firebase-auth-edge#246) * **#249:** merge error stack trace in token verifier to improve visibility on fetch errors ([6bce756](awinogrodzki/next-firebase-auth-edge@6bce756)), closes [#249](awinogrodzki/next-firebase-auth-edge#249) * add missing name property to decoded id token type ([39b086d](awinogrodzki/next-firebase-auth-edge@39b086d)) * pass cookie serialization options to cookie setter ([b28ce7a](awinogrodzki/next-firebase-auth-edge@b28ce7a)) * recreate canary tags after force push ([c9b7c18](awinogrodzki/next-firebase-auth-edge@c9b7c18)) * semantic-release rate exceeded error ([676b602](awinogrodzki/next-firebase-auth-edge@676b602)) * semantic-version git history issue ([d514f57](awinogrodzki/next-firebase-auth-edge@d514f57)) * update next.js peer dependency to rc ([f2953fd](awinogrodzki/next-firebase-auth-edge@f2953fd)) ### Features * **middleware:** introduced `redirectToPath` method and RegExp support in `redirectToLogin` method ([21024bb](awinogrodzki/next-firebase-auth-edge@21024bb)) * added `path` option to `redirectToHome` helper function ([54f07f4](awinogrodzki/next-firebase-auth-edge@54f07f4)) * allow setAuthCookies to accept custom auth headers or fall back ([b1d169b](awinogrodzki/next-firebase-auth-edge@b1d169b)) * experimental option to refresh token on expired kid header ([2869531](awinogrodzki/next-firebase-auth-edge@2869531)) * introduced `refreshCookiesWithIdToken` function to enable login using Server Actions ([#212](awinogrodzki/next-firebase-auth-edge#212)) ([6cd0b13](awinogrodzki/next-firebase-auth-edge@6cd0b13)) * next.js 15 rc support ([a994dd0](awinogrodzki/next-firebase-auth-edge@a994dd0)) * pass custom auth header from authMiddleware ([71286af](awinogrodzki/next-firebase-auth-edge@71286af)) * **getTokens:** introduced optional `cookieSerializeOptions` option ([e041542](awinogrodzki/next-firebase-auth-edge@e041542)) * replaced no matching kid auth error with invalid token error ([9d2d0fc](awinogrodzki/next-firebase-auth-edge@9d2d0fc)) * support Node.js 22 ([6c7f435](awinogrodzki/next-firebase-auth-edge@6c7f435))
After doing a preview deployment with Vercel, and then trying to log in on my site, the page just refreshes & I'm getting these errors in the Vercel logs:
Everything works fine locally.
I've tried using both
1.6.2
and1.7.0-canary.10
ofnext-firebase-auth-edge
- it didn't make a difference.Output of
npx next info
:And this is what my middleware looks like:
The text was updated successfully, but these errors were encountered: