Privacy Page 404 Error

TODO: collapasable, copyable, download, etc

I setup a SvelteKit app that I am now deploiying to Vercel. When I go to /privacy I see a 404.

config ```import adapter from '@sveltejs/adapter-vercel'; import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */ const config = { // Consult https://kit.svelte.dev/docs/integrations#preprocessors // for more information about preprocessors preprocess: vitePreprocess(),

kit: {
	// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
	// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
	// See https://kit.svelte.dev/docs/adapters for more information about adapters.
	adapter: adapter({runtime: 'edge'})
}

};

export default config;```

I have routes/privacy/+page.svelte

Using npm run dev, the site works correctly.If your SvelteKit app works locally but not when deployed to Vercel, especially in terms of routing to specific pages like /privacy, the issue might be related to configuration or how Vercel handles the deployment of static and dynamic routes.

Here are a few steps and checks you can perform to resolve the issue:

  1. Check File Structure: Ensure that the file structure under routes is correct. Your structure with routes/privacy/+page.svelte seems correct for SvelteKit, but it's worth double-checking for any typos or misplaced files.

  2. Deployment Configuration: In your configuration, you've specified { runtime: 'edge' } for the adapter. This tells Vercel to deploy your application on Vercel Edge Functions, which is generally correct. Make sure that all necessary configurations for edge functions are properly set up in your svelte.config.js.

  3. Check Vercel Build Output:

    • Go to your Vercel dashboard and check the build logs. Look for any warnings or errors related to the privacy page or routing in general.
    • Make sure that the build process is picking up the privacy route and that there are no issues during the compilation.
  4. SSR vs SSG: Since you are using runtime: 'edge', your app is likely intended to be server-side rendered. Confirm that Vercel is correctly identifying and generating the necessary server-side pages. Sometimes, static generation might skip pages if not configured correctly.

  5. Vercel Configuration:

    • Ensure that the Vercel project settings are correctly set to handle SvelteKit applications. Sometimes, custom settings or redirects in the Vercel configuration (vercel.json) might interfere with routing.
    • You can add specific rewrite rules in vercel.json to ensure that requests are properly routed to your SvelteKit handler:
    {
      "rewrites": [
        { "source": "/privacy", "destination": "/privacy.html" }
      ]
    }
    
  6. Fallback Handling: If you suspect that Vercel is not properly handling dynamic routes, you might want to set up a fallback page or check how the routes are being served.

  7. Local vs Deployed Environment Differences: Sometimes, differences in environment variables or configurations between your local setup and Vercel might cause issues. Ensure all environment configurations are consistent.

  8. Check for Updates or Bugs: Make sure that your @sveltejs/kit and @sveltejs/adapter-vercel packages are up to date. Occasionally, bugs that affect deployment could be fixed in newer versions of these packages.

If after these checks the issue persists, you might want to create a minimal reproducible example and test deploying that or reach out to Vercel support for more specific guidance related to their platform.

Privacy Page 404 Error created at Tue Jan 20 1970 21:34:13 GMT+0000 (Coordinated Universal Time)

Related Chats

Privacy Page 404 Error 0.999

Fix SvelteKit Playwright Test 0.600

SvelteKit: Handling require in Client 0.547

SvelteKit Route Naming Conventions 0.523

Auth Config with Dynamic URL 0.523

Client-Only Component in SvelteKit 0.510

New chat 0.499

New chat 0.496

Server-Side Code Placement 0.482

Settings Toggle Endpoint Setup 0.471