Search code examples
sveltekit

Missing 'invalid' export from '@sveltejs/kit'


After updating my SvelteKit project, because Netlify has started giving me some grief, my builds are failing with this error:

"invalid" is not exported by "node_modules/@sveltejs/kit/src/exports/index.js", imported by "src/routes/+page.server.ts"

I have this line in my +page.server.ts that's causing the error:

import { redirect, invalid, error } from "@sveltejs/kit";

I've looked it up and indeed there is no Invalid export in that index.js file.

Before the update, everything was working fine.

Cheers.

Before update, everything worked just fine


Solution

  • Replace invalid with fail

    import { fail } from '@sveltejs/kit';
    

    https://kit.svelte.dev/docs/form-actions