KoesterJannik / sveltekit-repo-starter

45 stars 3 forks source link

I get 404: NOT_FOUND when I try to access my site on vercel but it works perfectly on local #12

Closed paulotokolo closed 7 months ago

paulotokolo commented 7 months ago

I uploaded my site to Vercel through github but I get a 404 error when I try to access the URL. The database migrations worked perfectly. On my PC I'm able to create an account, login and also logout via my localhost. On Vercel, I can see the database migrated tables and new users, I can also see the different sessions too, but when I load my Vercel link it shows a 404 error. vercel 404

For my Environment Variables I changed the NODE_ENV to "production", it was "development" before, I've tried changing it to both "development" and "production" and I still get the 404 NOT_FOUND ERROR. For my BASE_URL i changed it to "https://mywebsiteurl.vercel.app/" from "localhost:5173" and yet I still get the 404 Error. Below are my Environment Variables: environment variables

For my build and development settings on Vercel I changed the output directory because i was having an error that said: 'no output directory named "public" found after the build complete.' (similar issue here on stackoverflow: https://stackoverflow.com/questions/77071902/404-not-found-when-deploying-sveltekit-to-vercel-using-turborepo-when-100-turb )

build

The authentication works perfectly on localhost and all the migrations worked successfully, just that i get a 404 error in production. Thanks for this repo-starter and I'm desperately waiting for your feedback

sheyzi commented 7 months ago

Hello, please share your vercel configuration.

paulotokolo commented 7 months ago

Hello, please share your vercel configuration.

Where can that be found? (If you're referring to vercel.json I don't have that file). Here is my repository: https://github.com/paulotokolo/otoksmarket

KoesterJannik commented 7 months ago

Have you changed the Adapter from node to Auto?

paulotokolo commented 7 months ago

Have you changed the Adapter from node to Auto?

No, in what file should I do that?

sheyzi commented 7 months ago

Have you changed the Adapter from node to Auto?

No, in what file should I do that?

Check the svelte.config.js

paulotokolo commented 7 months ago

Have you changed the Adapter from node to Auto?

No, in what file should I do that?

Check the svelte.config.js

Okay, I will do that and get back to you ⏳

paulotokolo commented 7 months ago

Have you changed the Adapter from node to Auto?

No, in what file should I do that?

Check the svelte.config.js

I did as you said, I changed the Adapter from node to Auto and it worked. For those with similar issues, after changing the adapter from node to auto, make sure to also install @sveltejs/adapter-auto if you haven't already:

npm install --save-dev @sveltejs/adapter-auto

This will configure your SvelteKit project to use the auto adapter, which will automatically select the best adapter based on your environment. Thank you @sheyzi @KoesterJannik