Skip to content

Returning non-200 status from load in __layout.svelte causes a Uncaught (in Promise) Error  #4815

@poppa

Description

@poppa

Describe the bug

Returning a non-200 status from load in __layout.svelte in a Svelte-Kit app results in an uncaught promise error.

It seems to me said function is called recursively when returning a non-200 status. If you track the number of calls and return 200 after the first call to load everything seems to be fine.

Reproduction

https://github.com/poppa/svelte-kit-uncaught-in-promise-sample

Logs

__layout.svelte? [sm]:26 Uncaught (in promise) Error: Authentication Required
    at load (__layout.svelte? [sm]:26:14)
    at load_node (start.js:946:37)
    at Object._hydrate (start.js:1575:25)
    at async start (start.js:1676:3)

System Info

System:
    OS: macOS 11.6
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 53.85 MB / 32.00 GB
    Shell: 3.3.1 - /usr/local/bin/fish
  Binaries:
    Node: 16.13.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 8.1.0 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 101.1.38.111
    Chrome: 101.0.4951.54
    Firefox: 98.0.1
    Safari: 15.0
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.40 
    @sveltejs/kit: next => 1.0.0-next.324 
    svelte: ^3.44.0 => 3.48.0

Severity

serious, but I can work around it

Additional Information

You guys are doing a great job, and Svelte and Svelte-Kit is just awesome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    error handlingload / layoutp1-importantSvelteKit cannot be used by a large number of people, basic functionality is missing, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions