Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(nuxt3,bridge): rename error handler url #4215

Merged
merged 2 commits into from
Apr 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/bridge/src/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export async function setupNitroBridge () {
nitro.options.handlers.push(...handlers)
nitro.options.devHandlers.push(...devHandlers)
nitro.options.handlers.unshift({
route: '/_nitro',
route: '/__nuxt_error',
lazy: true,
handler: resolve(distDir, 'runtime/nitro/renderer')
})
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt3/src/core/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export async function initNitro (nuxt: Nuxt) {
nitro.options.handlers.push(...handlers)
nitro.options.devHandlers.push(...devHandlers)
nitro.options.handlers.unshift({
route: '/_nitro',
route: '/__nuxt_error',
lazy: true,
handler: resolve(distDir, 'core/runtime/nitro/renderer')
})
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt3/src/core/runtime/nitro/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default async function handleError (error: any, event: CompatibilityEvent
}

// HTML response
const url = withQuery('/_nitro/__error', errorObject as any)
const url = withQuery('/__nuxt_error', errorObject as any)
const html = await $fetch(url).catch(() => errorObject.statusMessage)

event.res.setHeader('Content-Type', 'text/html;charset=UTF-8')
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt3/src/core/runtime/nitro/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function renderToString (ssrContext) {

export default eventHandler(async (event) => {
// Whether we're rendering an error page
const ssrError = event.req.url?.startsWith('/__error') ? useQuery(event) : null
const ssrError = event.req.url?.startsWith('/__nuxt_error') ? useQuery(event) : null
let url = ssrError?.url as string || event.req.url!

// payload.json request detection
Expand Down