nuxt
nuxt copied to clipboard
Server will print recursive errors in undefined routes
- nuxt: v3.0.0-rc.4
- node: v17.0.0
Problem
i have a nuxtjs project with express (for server middleware) ... in dev everythings is okay but when i build app, in wrong routes or better i say not found routes server not respond to client and will print recursive errors ... i solve this problems for my routes in express but for assets (img, css, ...) i stil have this problem ... for example in build app when i try to change img tag src and client send requetst to server to get new image, server print that recursive errors and i should restart the app in terminal
my nuxt config file for server middleware is:
serverMiddleware: [
{
path: "/",
handler: "./server/main"
}
],
and in ./server/main file i have different modules, routes and middlewares
and this is a part of recursive error in my terminal
2526data%25252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252526statusCode=500%25252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252526statusMessage=Internal%2525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252BServer%2525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252BError%25252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252526message=Cannot%2525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252Bset%2525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252Bproperties%2525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525
all errors are duplicate and say can't set property on undefined variable (location) and it seems this is related to h3 module
What is Expected?
i excepted to server response to client with 404 status code
What is actually happening?
server responsed with 500 (internal server error) and server print recursive and repeat errors and i should stop server and run it again
server print this is recursive error:
[nuxt] [request error] Cannot set properties of undefined (setting 'location')
at createError (./server/node_modules/h3/dist/index.mjs:188:15)
at Immediate.next (./server/node_modules/h3/dist/index.mjs:243:27)
at Immediate.<anonymous> (./server/node_modules/express/lib/router/index.js:646:15)
at processImmediate (node:internal/timers:466:21)