nextauthjs / nextauthjs/next-auth
getting "SvelteKitError: Not found: /signin/..-" after updating to svelte 5
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28.4k
- Forks
- 4k
- PR merge metrics
- No merged PRs in 30d
Description
Environment
System:
OS: macOS 15.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 89.30 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.14.0 - /etc/profiles/per-user/marvin/bin/node
Yarn: 1.22.21 - /opt/homebrew/bin/yarn
npm: 10.9.2 - /etc/profiles/per-user/marvin/bin/npm
Browsers:
Safari: 18.3
npmPackages:
@auth/prisma-adapter: ^2.8.0 => 2.8.0
@auth/sveltekit: ^1.7.4 => 1.8.0
Reproduction URL
https://github.com/martin-gif/sveltekit-auth-example
Describe the issue
Nach dem Update auf Svelte 5 mit svelte kit 2 bekommen ich bei einer Clint side 'signIn' den Fehler SvelteKitError: Not found: /signin/keycloak und einen Status '404'. Der Button ist relativ simple:
import { signIn, signOut } from '@auth/sveltekit/client';
<button
onclick={() => signIn('keycloak')}
>
Login
</button>
hier noch einmal mein src/auth.ts
import { SvelteKitAuth } from '@auth/sveltekit';
import { PrismaAdapter } from '@auth/prisma-adapter';
import { prisma } from '$lib/server/DB';
import Keycloak from '@auth/sveltekit/providers/keycloak';
export const { signIn, signOut, handle } = SvelteKitAuth({
debug: true,
adapter: PrismaAdapter(prisma),
providers: [Keycloak],
callbacks: {
session({ session, user }) {
session.user.id = user.id; // kann man später mal schauen, ob man das angreifen kann
return session;
}
}
});
and src/hooks.server.ts
import { redirect, type Handle } from '@sveltejs/kit';
import { handle as authenticationHandle } from './auth';
import { sequence } from '@sveltejs/kit/hooks';
const authentication: Handle = async ({ event, resolve }) => {
if (event.url.pathname.endsWith('/feedback')) {
const session = await event.locals.auth();
if (!session) {
throw redirect(303, '/auth/signin');
}
}
return resolve(event);
};
export const handle: Handle = sequence(authenticationHandle, authentication);
i'm still quite new to svelte web development, so unfortunately i can't rule out the possibility that i made the mistake. If there is any information missing, I can provide it. the bug exists in the @auth/sveltekit versions 1.7.3,1.7.4,1.8.0.
How to reproduce
- Download repo from the link provided
- install packages (I used Yarn in the repo)
- start page with
vite dev - click login button
Expected behavior
the keycloak login page opens and you can log in as a user
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproduction repository, then read src/auth.ts and src/hooks.server.ts to understand the SvelteKit authentication setup. Install its packages, run vite dev, and click the login button. Done means the Keycloak login page opens instead of producing a SvelteKitError 404 for the signin path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100