Skip to content
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

Cannot read properties of undefined (reading 'name') issue when deployed to Vercel #289

Open
lidholm opened this issue Dec 4, 2024 · 2 comments
Assignees

Comments

@lidholm
Copy link

lidholm commented Dec 4, 2024

I'm trying to get the library working when deploying to Vercel. I have copied the minimal example and it seems to work fine when running it locally. But when deploying to Vercel it fails saying

This Edge Function has crashed.

Your connection is working correctly.

Vercel is working correctly.

500: INTERNAL_SERVER_ERROR
Code: EDGE_FUNCTION_INVOCATION_FAILED
ID: sfo1::tt25x-1733286729047-39138c735356

and the logs are showing

TypeError: Cannot read properties of undefined (reading 'name')
    at (node_modules/next/dist/compiled/@edge-runtime/cookies/index.js:194:0)
    at (node_modules/next-firebase-auth-edge/browser/next/cookies/parser/RequestCookiesProvider.js:14:0)
    at (node_modules/next-firebase-auth-edge/browser/next/cookies/parser/CookieParserFactory.js:34:0)
    at (node_modules/next-firebase-auth-edge/browser/next/cookies/parser/CookieParserFactory.js:51:34)
    at (node_modules/next-firebase-auth-edge/browser/next/tokens.js:17:38)
    at (node_modules/next-firebase-auth-edge/browser/next/middleware.js:108:29)
    at (middleware.ts:8:9)
    at (node_modules/next/dist/esm/server/web/adapter.js:212:89)
    at (node_modules/next/dist/esm/server/web/adapter.js:212:49)

Since it is working locally but not when deployed, my best guess is that I have screwed up environment variables somehow, but not sure what.
I have some set through .env.production and some are set inside Vercel

Does the stacktrace tell you anything from here? Or do you have some tips on how I should continue debugging the issue?

@lidholm
Copy link
Author

lidholm commented Dec 4, 2024

Small update:
I tried debugging this more, and now think that maybe I had an issue with old cookies or something. After trying to remove code to find the issue and then adding it back, I now have the same code and it is working to log in (on the deployment from my branch).
I am still getting the same error in the logs though, which is a bit unfortunate since it is making it harder to look for other errors

@awinogrodzki
Copy link
Owner

Hey @lidholm!

Sorry for delayed response, I've been pretty busy in December

Could you run npx next info in the project directory and share the console output?

Since the error happens in next/dist/compiled/@edge-runtime, it might be related to specific Next.js version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants