404 Error for /api/auth/sign-up

When attempting to access the sign-up endpoint via /api/auth/sign-up/email, the SvelteKit app throws a 404 error:
SvelteKitError: Not found: /api/auth/sign-up/email
at resolve (/home/ubuntu/v2/frontend/node_modules/@sveltejs/kit/src/runtime/server/respond.js:582:13)
at /home/ubuntu/v2/frontend/node_modules/@sveltejs/kit/src/runtime/server/respond.js:370:7
at AsyncLocalStorage.run (node:async_hooks:346:14)
at with_event (/home/ubuntu/v2/frontend/node_modules/@sveltejs/kit/src/runtime/app/server/event.js:49:20)
at resolve (/home/ubuntu/v2/frontend/node_modules/@sveltejs/kit/src/runtime/server/respond.js:369:6)
at svelteKitHandler (file:///home/ubuntu/v2/frontend/node_modules/better-auth/dist/integrations/svelte-kit.mjs:18:10)
at async respond (/home/ubuntu/v2/frontend/node_modules/@sveltejs/kit/src/runtime/server/respond.js:363:20)
at async file:///home/ubuntu/v2/frontend/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:521:22
SvelteKitError: Not found: /api/auth/sign-up/email
at resolve (/home/ubuntu/v2/frontend/node_modules/@sveltejs/kit/src/runtime/server/respond.js:582:13)
at /home/ubuntu/v2/frontend/node_modules/@sveltejs/kit/src/runtime/server/respond.js:370:7
at AsyncLocalStorage.run (node:async_hooks:346:14)
at with_event (/home/ubuntu/v2/frontend/node_modules/@sveltejs/kit/src/runtime/app/server/event.js:49:20)
at resolve (/home/ubuntu/v2/frontend/node_modules/@sveltejs/kit/src/runtime/server/respond.js:369:6)
at svelteKitHandler (file:///home/ubuntu/v2/frontend/node_modules/better-auth/dist/integrations/svelte-kit.mjs:18:10)
at async respond (/home/ubuntu/v2/frontend/node_modules/@sveltejs/kit/src/runtime/server/respond.js:363:20)
at async file:///home/ubuntu/v2/frontend/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:521:22
/home/ubuntu/v2/frontend/src/hooks.server.ts

import { auth } from "$lib/auth";
import { svelteKitHandler } from "better-auth/svelte-kit";

export async function handle({ event, resolve }) {
if (
event.url.pathname.startsWith(
'/.well-known/appspecific/com.chrome.devtools'
)
) {
return new Response(null, { status: 204 }); // Return empty response with 204 No Content
}

return svelteKitHandler({ event, resolve, auth });
}
/home/ubuntu/v2/frontend/src/hooks.server.ts

import { auth } from "$lib/auth";
import { svelteKitHandler } from "better-auth/svelte-kit";

export async function handle({ event, resolve }) {
if (
event.url.pathname.startsWith(
'/.well-known/appspecific/com.chrome.devtools'
)
) {
return new Response(null, { status: 204 }); // Return empty response with 204 No Content
}

return svelteKitHandler({ event, resolve, auth });
}
import { createAuthClient } from "better-auth/svelte"


export const authClient = createAuthClient({
baseURL: "https://sub.domain.de"
});

import { createAuthClient } from "better-auth/svelte"


export const authClient = createAuthClient({
baseURL: "https://sub.domain.de"
});

does anyone have an idea why this happens?
3 Replies
Yannik
YannikOP6d ago
any idea? @Ping
Ping
Ping6d ago
Can i see your auth config? @Yannik
Yannik
YannikOP5d ago
sure @Ping
import { betterAuth } from "better-auth";
import { twoFactor, anonymous, phoneNumber, emailOTP, admin, organization, bearer, captcha, haveIBeenPwned } from "better-auth/plugins"
import { passkey } from "better-auth/plugins/passkey"
import { prismaAdapter } from "better-auth/adapters/prisma";
import prisma from "$lib/server/prisma";


export const auth = betterAuth({
secret: process.env.BETTER_AUTH_SECRET as string,
baseURL: process.env.BETTER_AUTH_URL as string,
database: prismaAdapter(prisma, {
provider: "postgresql",
}),
appName: "AuthClient2025",
plugins: [
twoFactor(),
anonymous(),
phoneNumber({
sendOTP: ({ phoneNumber, code }, request) => {
// Implement sending OTP code via SMS
}
}),
emailOTP({
async sendVerificationOTP({ email, otp, type }) {
// Implement the sendVerificationOTP method to send the OTP to the user's email address
},
}),
passkey(),
admin(),
organization(),
bearer(),
haveIBeenPwned(),
],
emailAndPassword: {
enabled: true
},
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID as string,
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
},
},
});
import { betterAuth } from "better-auth";
import { twoFactor, anonymous, phoneNumber, emailOTP, admin, organization, bearer, captcha, haveIBeenPwned } from "better-auth/plugins"
import { passkey } from "better-auth/plugins/passkey"
import { prismaAdapter } from "better-auth/adapters/prisma";
import prisma from "$lib/server/prisma";


export const auth = betterAuth({
secret: process.env.BETTER_AUTH_SECRET as string,
baseURL: process.env.BETTER_AUTH_URL as string,
database: prismaAdapter(prisma, {
provider: "postgresql",
}),
appName: "AuthClient2025",
plugins: [
twoFactor(),
anonymous(),
phoneNumber({
sendOTP: ({ phoneNumber, code }, request) => {
// Implement sending OTP code via SMS
}
}),
emailOTP({
async sendVerificationOTP({ email, otp, type }) {
// Implement the sendVerificationOTP method to send the OTP to the user's email address
},
}),
passkey(),
admin(),
organization(),
bearer(),
haveIBeenPwned(),
],
emailAndPassword: {
enabled: true
},
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID as string,
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
},
},
});
@Ping have you seen this

Did you find this page helpful?