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

This commit is contained in:
Daniel Roe 2022-04-09 10:52:42 +01:00 committed by GitHub
parent f2fc135721
commit edd0b30896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -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')
})

View File

@ -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')
})

View File

@ -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')

View File

@ -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