I am running remix from an express server with nodejs
When a route is not found, I see in the console:
ErrorResponseImpl {
status: 404,
statusText: 'Not Found',
internal: true,
data: 'Error: No route matches URL "/favicon.ico"',
error: Error: No route matches URL "/favicon.ico"
at getInternalRouterError (/Users/dangoodman/code/node-express-remix-template/node_modules/@remix-run/server-runtime/node_modules/@remix-run/router/router.ts:4487:5)
at Object.query (/Users/dangoodman/code/node-express-remix-template/node_modules/@remix-run/server-runtime/node_modules/@remix-run/router/router.ts:2933:19)
at handleDocumentRequestRR (/Users/dangoodman/code/node-express-remix-template/node_modules/@remix-run/server-runtime/dist/server.js:180:35)
at requestHandler (/Users/dangoodman/code/node-express-remix-template/node_modules/@remix-run/server-runtime/dist/server.js:105:24)
at /Users/dangoodman/code/node-express-remix-template/node_modules/@remix-run/express/dist/server.js:41:28
}
I have the following code in my entry.server.tsx
which catches certain logs, but this is not something I am logging.
export function handleError(
error: any,
{ request, params, context }: LoaderFunctionArgs | ActionFunctionArgs
) {
if (!request.signal.aborted && !error.data?.includes("No route matches URL")) {
logger.error(
{
err: extractError(error),
},
"unhandled remix error"
)
}
}
and call remix from express like
app.all("*", createRequestHandler({ build: build as any }))
Previously, setting NODE_ENV=production stopped this output, but it seems that either something else stopped it previously or it has come back.
How can I stop these logs?
Adding a ErrorBoundary
in root.tsx
stopped the error.
NODE_ENV=production
stopped the No routes...
log line