Skip to content

Erroring prerender remote functions don't fail the build #14242

@Rich-Harris

Description

@Rich-Harris

Describe the bug

If I have a prerender function that errors...

// src/lib/data.remote.ts
import { prerender } from '$app/server';

export const oops = prerender(() => {
  throw new Error('oops');
});

...I would expect that error to fail the build. Instead, the error gets serialized and the build continues.

Normally if a route fails to prerender, it results in the prerender.handleHttpError function being called, which defaults to throwing an informative error. I'm not sure whether we want to reuse that function (perhaps with different values) or create a new one.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-oy33huhv?file=.svelte-kit%2Foutput%2Fprerendered%2Fdata%2F_app%2Fremote%2F19aeq9f%2Foops

Logs

System Info

latest

Severity

annoyance

Additional Information

No response

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