Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/cli/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,26 @@ async function runFastify(opts: Args) {
loggerInstance: logger as unknown as FastifyBaseLogger,
disableRequestLogging: true,
pluginTimeout: 60 * 1000,
clientErrorHandler: (err, socket) => {
logger.fatal(err);
if (err.code === 'ECONNRESET') {
return
}

const body = JSON.stringify({
error: 400,
message: 'Client Error',
statusCode: 400
})

if (socket.writable) {
socket.end([
'HTTP/1.1 400 Bad Request',
`Content-Length: ${body.length}`,
`Content-Type: application/json\r\n\r\n${body}`
].join('\r\n'))
}
},
});

const routes: RouteOptions[] = [];
Expand Down
Loading