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

Redirect in beforeLoad not working using bun preset #3054

Open
MarcMogdanz opened this issue Dec 22, 2024 · 0 comments
Open

Redirect in beforeLoad not working using bun preset #3054

MarcMogdanz opened this issue Dec 22, 2024 · 0 comments
Labels
start Everything about TanStack Start

Comments

@MarcMogdanz
Copy link

Which project does this relate to?

Start

Describe the bug

I have a setup where I have a group of routes called _app which all my authenticated routes are grouped into. In the beforeLoad of the _app.tsx I'm doing my auth check and if the user is not authenticated, they will be redirect to /login. This works fine when running in dev mode but running the compiled output you won't be redirected and only get a blank white page when going to /dashboard.

It feels like it could be somehow related to this issue here: #1295

I can also confirm that it does work when not using Bun. Removing server: { preset: "bun" } from my app.config.ts and then building + running it via node does resolve the issue when running the prod output.

Your Example Website or App

https://codesandbox.io/p/devbox/krp8d5

Steps to Reproduce the Bug or Issue

  1. Run bun run build
  2. Run bun run .output/server/index.mjs
  3. Go to /dashboard

The dashboard route is protected and always redirects you to /login. It works as expected when running bun run dev but in the compiled output it just sends a blank page on the /dashboard path and does not redirect the user.

Expected behavior

Going to /dashboard should redirect me to /login.

Screenshots or Videos

No response

Platform

  • OS: MacOS 14.4.1
  • Browser: Chromium
  • Version: 131.0.6778.108

Additional context

No response

@schiller-manuel schiller-manuel added the start Everything about TanStack Start label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
start Everything about TanStack Start
Projects
None yet
Development

No branches or pull requests

2 participants