Skip to content

useAppSession always return null session in production build #3949

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

Open
nguyenthinhkha opened this issue Apr 6, 2025 · 1 comment
Open

Comments

@nguyenthinhkha
Copy link

Which project does this relate to?

Router

Describe the bug

useAppSession always return null session in node-server production build

Your Example Website or App

https://codesandbox.io/p/devbox/github/tanstack/router/tree/main/examples/react/start-basic-auth

Steps to Reproduce the Bug or Issue

  1. Clone example https://tanstack.com/start/latest/docs/framework/react/examples/start-basic-auth
  2. run npm install && npm run build
  3. run node .output/server/index.mjs
    If you had problem at step 3 due to no environment load, you can add cp .env ./.output/server/.env into build script to pass this step
  4. Launch http://{your-ip}:3000

You will see the web app launched, but after signip/signup then click on Posts, it will bring you back to login again. Debug on fetchUser server func, it always return null session.

Expected behavior

User can access authed route after login in production build

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: latest

Additional context

No response

@nguyenthinhkha
Copy link
Author

Follow adding cookie at this issue solved my problem
#3492

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