Skip to content

redirect in server loader doesn't work #622

@Avizura

Description

@Avizura

Current Behavior

import { redirect } from 'one'

export async function loader() {
    throw redirect('/profile')
}

Result:

SSR error while loading file ./notifications+ssr.tsx from URL http://localhost:8081/notifications
 Response {
  status: 302,
  statusText: '',
  headers: Headers { location: 'http://0.0.0.0:8081/profile' },
  body: null,
  bodyUsed: false,
  ok: false,
  redirected: false,
  type: 'default',
  url: ''
}
Error rendering /notifications on server
 [object Response]

Expected Behavior

Actual redirect

One Version

1.1.513

Platform (Web, iOS, Android)

Web

Reproduction

1. npx one -> Fullstack starter
2. Add the following loader to any page+ssr

import { redirect } from 'one'

export async function loader() {
    throw redirect('/profile')
}

System Info

System:
    OS: macOS 15.4
    CPU: (8) arm64 Apple M1 Pro
    Memory: 343.14 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.15.0 - ~/.nvm/versions/node/v22.15.0/bin/node
    Yarn: 4.9.2 - /opt/homebrew/bin/yarn
    npm: 10.9.2 - ~/.nvm/versions/node/v22.15.0/bin/npm
    bun: 1.2.15 - ~/.bun/bin/bun
    Watchman: 2025.05.26.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 139.0.7258.139
    Safari: 18.4
  npmPackages:
    @biomejs/biome: 1.9.4 => 1.9.4 
    @dotenvx/dotenvx: ^1.12.1 => 1.48.4 
    @faker-js/faker: next => 10.0.0-beta.0 
    @react-native-community/cli: 19.0.0 => 19.0.0 
    @tamagui/config: ^1.132.16 => 1.132.16 
    @tamagui/image-next: ^1.132.16 => 1.132.16 
    @tamagui/lucide-icons: ^1.132.16 => 1.132.16 
    @tamagui/vite-plugin: ^1.132.16 => 1.132.16 
    @types/react: ^18.3.11 => 18.3.23 
    @vxrn/color-scheme: 1.1.513 => 1.1.513 
    better-sqlite3: ^11.2.1 => 11.10.0 
    dotenv: ^16.4.5 => 16.6.1 
    drizzle-kit: ^0.24.2 => 0.24.2 
    drizzle-orm: ^0.33.0 => 0.33.0 
    expo: 53.0.20 => 53.0.20 
    expo-linear-gradient: ~14.1.5 => 14.1.5 
    expo-modules-core: ~2.5.0 => 2.5.0 
    one: 1.1.513 => 1.1.513 
    postgres: ^3.4.4 => 3.4.7 
    react: ~19.0.0 => 19.0.0 
    react-native: ~0.79.2 => 0.79.5 
    react-native-reanimated: ~3.17.4 => 3.17.5 
    react-native-safe-area-context: 5.4.0 => 5.4.0 
    react-native-screens: 4.10.0 => 4.10.0 
    react-native-svg: 15.11.2 => 15.11.2 
    react-native-web: ~0.20.0 => 0.20.0 
    tamagui: ^1.132.16 => 1.132.16 
    tsx: ^4.19.0 => 4.20.3 
    typescript: ^5.7.3 => 5.9.2 
    vite: ^7.0.1 => 7.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions