Skip to content

fix: switch to adapter-vercel and fix CSP nonce mismatch#464

Open
tazmeen24 wants to merge 1 commit into
Dev-Card:mainfrom
tazmeen24:fix/csp-nonce-issue
Open

fix: switch to adapter-vercel and fix CSP nonce mismatch#464
tazmeen24 wants to merge 1 commit into
Dev-Card:mainfrom
tazmeen24:fix/csp-nonce-issue

Conversation

@tazmeen24
Copy link
Copy Markdown

@tazmeen24 tazmeen24 commented Jun 3, 2026

Summary

Fixes blank page on Vercel caused by CSP nonce mismatch. Switches from adapter-auto + nonce-based CSP to adapter-vercel + hash-based CSP, which is stable on serverless.

Closes #404


Type of Change

  • Bug fix
  • Security

What Changed

  • Switched @sveltejs/adapter-auto@sveltejs/adapter-vercel
  • Changed CSP mode 'auto''hash'
  • Removed 'unsafe-inline' from script-src
  • Added 'http://localhost:3000' to connect-src for local dev

Before

Screenshot 2026-05-30 105750

After

image

How to Test

cd apps/web
pnpm run build
pnpm run preview

Verify: JS files load in Network tab, page renders (not blank)


Checklist

  • Code follows project style
  • TypeScript compiles
  • No debug statements

Additional Context

Backend CORS is hardcoded to localhost:5173 (the dev server port). The preview runs on port 4173 instead. For local testing, either:

  • Update backend CORS to allow localhost:4173, OR
  • Use pnpm dev to run web on localhost:5173

(This is a separate backend issue, not CSP-related)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

CI Results — ❌ Some checks failed

🖥️ Backend (⏭️ skipped)

Check Status
Lint ⚪ unknown
Test ⚪ unknown
Typecheck ⚪ unknown

📱 Mobile (⏭️ skipped)

Check Status
Lint ⚪ unknown
Test ⚪ unknown

🌐 Web (❌ failure)

Check Status
Check ❌ failure
Build ✅ success

🕐 Last updated: Wed, 03 Jun 2026 11:23:39 GMT

@tazmeen24 tazmeen24 force-pushed the fix/csp-nonce-issue branch from 235427b to 85e8bd6 Compare June 3, 2026 11:03
@Harxhit Harxhit added the gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking. label Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Blank page on web app - CSP blocks SvelteKit hydration scripts

2 participants