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

Commit

Permalink
fix(nuxt3,bridge): rename error handler url (#4215)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Apr 9, 2022
1 parent f2fc135 commit edd0b30
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
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

0 comments on commit edd0b30

Please sign in to comment.