SvelteKitError: Not found: /api/auth/sign-up/email

I'm using SvelteKit, and I encounter the following error when trying to sign up with email: SvelteKitError: Not found: /api/auth/sign-up/email. I have hooks.server.ts inside the src folder, and auth.ts and auth-client.ts inside lib. How can I fix this?
No description
Solution:
I implemented it in Sveltekit like this hooks.server.ts ```ts import type { Handle, RequestEvent } from '@sveltejs/kit';...
Jump to solution
2 Replies
Solution
shubhattin
shubhattin2mo ago
I implemented it in Sveltekit like this hooks.server.ts
import type { Handle, RequestEvent } from '@sveltejs/kit';
import { auth } from '$lib/auth';
import { svelteKitHandler } from 'better-auth/svelte-kit';

export const handle: Handle = async ({ event, resolve }) => {
return svelteKitHandler({ event, resolve, auth });
};
import type { Handle, RequestEvent } from '@sveltejs/kit';
import { auth } from '$lib/auth';
import { svelteKitHandler } from 'better-auth/svelte-kit';

export const handle: Handle = async ({ event, resolve }) => {
return svelteKitHandler({ event, resolve, auth });
};
shubhattin
shubhattin2mo ago
Ok so it should be hooks.server.tshook.server.ts ❌ in the image you shared you have a file naming typo

Did you find this page helpful?