Skip to content

useAppSession always return null session in production build #3949

@nguyenthinhkha

Description

@nguyenthinhkha

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions