delay / sveltekit-auth-starter

This is a Sveltekit auth starter project. It utilizes Lucia for authentication, Skeleton for ui elements, Prisma for database connectivity and type safety, Lucide for icons, inlang for translation, Zod and Superforms to handle forms and validation and Sveltekit.
https://sveltekit-auth-starter.vercel.app
MIT License
221 stars 31 forks source link

Getting an odd error... Error: Not found: /__webpack_hmr/client #13

Closed patrickbolle closed 1 year ago

patrickbolle commented 1 year ago

Hi there! There isn't any mention of webpack in this repo so I don't expect this to be an otherwise known error, but running this project I receive this error while just randomly navigating the app (which otherwise seems to run perfectly, besides it being really slow to load which could be caused by this.

After running npm run dev this occurs:


null
null
6:25:57 p.m. [vite] ✨ new dependencies optimized: @skeletonlabs/skeleton, lucide-svelte, zod, sveltekit-superforms/client
6:25:57 p.m. [vite] ✨ optimized dependencies changed. reloading

  lucia   Debug mode disabled
Error: Not found: /__webpack_hmr/client
    at resolve (/home/patrick/Projects/mvp/node_modules/@sveltejs/kit/src/runtime/server/respond.js:430:13)
    at resolve (/home/patrick/Projects/mvp/node_modules/@sveltejs/kit/src/runtime/server/respond.js:277:5)
    at Object.handle (/home/patrick/Projects/mvp/src/hooks.server.ts:19:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Module.respond (/home/patrick/Projects/mvp/node_modules/@sveltejs/kit/src/runtime/server/respond.js:274:20)
    at async file:///home/patrick/Projects/mvp/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:505:22
null
null

and just for reference, my hooks.server.ts looks like:

import { auth } from '$lib/server/lucia';
import { redirect, type Handle } from '@sveltejs/kit';

export const handle: Handle = async ({ event, resolve }) => {
    event.locals.auth = auth.handleRequest(event);
    if (event.locals?.auth) {
        const { user } = await event.locals.auth.validateUser();
        event.locals.user = user;
        if (event.route.id?.startsWith('/(protected)')) {
            if (!user) throw redirect(302, '/auth/sign-in');
            if (!user.verified) throw redirect(302, '/auth/verify/email');
        }
    }

    return await resolve(event);
};

Node version: v18.12.0 npm version: 8.19.0

Any ideas here? Really wacky.

patrickbolle commented 1 year ago

Seems to be resolved with your newest updates from the last few weeks. Not sure how, but I'll take it :) Thanks for the repo!