-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
🐛 Bug Report
I've created a simple "Hello World" fastify example with a errorHandler, and it always throws a 404. Why?
To Reproduce
const fastify = require("fastify");
const server = fastify();
server.setErrorHandler(error => {
console.log("hello error!", error);
});
server.get("/test", (request, reply) => {
reply.send({ hello: "world" });
});
server.listen(8080, error => {
if (error) throw error;
console.log("Listening...");
});Expected behavior
The response is sent successfully so I'd not expect any errors here, especially a 404.
Paste the results here:
hello error! Error: Not Found
at Context.basic404 [as handler] (/home/jsarnowski/Workshop/fastify-static-error/node_modules/fastify/lib/fourOhFour.js:52:26)
at preHandlerCallback (/home/jsarnowski/Workshop/fastify-static-error/node_modules/fastify/lib/handleRequest.js:112:30)
at preValidationCallback (/home/jsarnowski/Workshop/fastify-static-error/node_modules/fastify/lib/handleRequest.js:101:5)
at handler (/home/jsarnowski/Workshop/fastify-static-error/node_modules/fastify/lib/handleRequest.js:70:5)
at handleRequest (/home/jsarnowski/Workshop/fastify-static-error/node_modules/fastify/lib/handleRequest.js:19:5)
at onRunMiddlewares (/home/jsarnowski/Workshop/fastify-static-error/node_modules/fastify/fastify.js:357:7)
at middlewareCallback (/home/jsarnowski/Workshop/fastify-static-error/node_modules/fastify/fastify.js:338:7)
at Object.routeHandler [as handler] (/home/jsarnowski/Workshop/fastify-static-error/node_modules/fastify/fastify.js:324:7)
at Router.lookup (/home/jsarnowski/Workshop/fastify-static-error/node_modules/find-my-way/index.js:338:14)
at Router.defaultRoute (/home/jsarnowski/Workshop/fastify-static-error/node_modules/fastify/fastify.js:635:23)Your Environment
- node version: 12.6.0
- fastify version: 2.7.1
- os: Linux
Metadata
Metadata
Assignees
Labels
No labels