Skip to content

fix: sanitize error messages in production mode#97

Merged
southpolesteve merged 1 commit intomainfrom
fix/sanitize-error-messages
Feb 26, 2026
Merged

fix: sanitize error messages in production mode#97
southpolesteve merged 1 commit intomainfrom
fix/sanitize-error-messages

Conversation

@southpolesteve
Copy link
Copy Markdown
Collaborator

Summary

Returns generic error messages in production responses instead of raw exception details. Full errors are still logged server-side for debugging.

  • App Router: new __sanitizeErrorForClient() replaces non-navigation errors with a generic message + djb2 digest hash (matching Next.js behavior) in production. Navigation errors (redirect, notFound, etc.) pass through unchanged with their digests intact.
  • Pages Router: error responses no longer include internal file paths
  • Middleware: production mode returns "Internal Server Error", dev mode preserves detail
  • Worker entry examples: updated to use generic error responses
  • RSC and SSR onError callbacks generate digest hashes for non-navigation errors in production, allowing server-log correlation without exposing details to clients

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 26, 2026

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/vinext@97

commit: a4c3cf6

@github-actions
Copy link
Copy Markdown

Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original

@southpolesteve southpolesteve enabled auto-merge (squash) February 26, 2026 04:23
@southpolesteve southpolesteve merged commit 7574231 into main Feb 26, 2026
24 checks passed
@southpolesteve southpolesteve deleted the fix/sanitize-error-messages branch February 26, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant