Skip to content

Remote query with redirect produce 500 undefined error #14883

@vladshcherbin

Description

@vladshcherbin

Describe the bug

Route with remote query which has redirect results in 500 undefined error.

Route:

<script lang="ts">
  import { verifyUser } from "$lib/remote/auth.remote";

  await verifyUser()
</script>

<p>protected</p>

Remote query:

import { query } from "$app/server";
import { redirect } from "@sveltejs/kit";

export const verifyUser = query(() => {
  redirect(307, '/')
})

Error:

Image

Reproduction

https://github.com/vladshcherbin/sveltekit-redirect-error

Logs

System Info

System:
    OS: macOS 26.0
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.0.1
    npm: 11.3.0
    pnpm: 10.20.0
  Browsers:
    Chrome: 142.0.7444.60
    Safari: 26.0
  npmPackages:
    @sveltejs/adapter-auto: ^7.0.0 => 7.0.0
    @sveltejs/kit: ^2.48.4 => 2.48.4
    @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1
    svelte: ^5.43.3 => 5.43.3
    vite: ^7.1.10 => 7.1.12

Severity

serious, but I can work around it

Additional Information

There is no error if query is wrapped inside <svelte:boundary>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions