Fix HTTPError.body forwarding in error handlers #3977
Draft
+29
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Nitro v3's error handlers were not forwarding H3 HTTPError
bodyproperties to clients. Thebodyfield should spread properties at the top level of error responses, per H3's error handling contract.Changes
src/runtime/internal/error/dev.ts: Spreaderror.bodyat top level of JSON responsesrc/runtime/internal/error/prod.ts: Spreaderror.bodyonly for non-sensitive errors (respects existing security model)Example
Before:
{ "error": true, "status": 500, "message": "Custom error message", "data": { "instance": "local" } }After:
{ "error": true, "status": 500, "message": "Custom error message", "data": { "instance": "local" }, "code": "urn:nitro:error-code" }Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
workers.cloudflare.com/usr/local/bin/node /usr/local/bin/node --conditions node --conditions production --experimental-import-meta-resolve --require /home/REDACTED/work/nitro/nitro/node_modules/.pnpm/vitest@4.0.17_@edge-runtime+vm@5.0.0_@types+node@25.0.9_jiti@2.6.1_lightningcss@1.31.1_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/suppress-warnings.cjs /home/REDACTED/work/nitro/nitro/node_modules/.pnpm/vitest@4.0.17_@edge-runtime+vm@5.0.0_@types+node@25.0.9_jiti@2.6.1_lightningcss@1.31.1_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/workers/forks.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.