hoangvvo / next-connect

The TypeScript-ready, minimal router and middleware layer for Next.js, Micro, Vercel, or Node.js http/http2

Home Page:https://www.npmjs.com/package/next-connect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hiding error stacktrace

opened this issue · comments

I am currently in dev and next-connect shows the whole error stacktrace to the frontend (client) is this intended ? using nextjs. Couldnt find any hide mechanism ! Thanks

commented

You should define the onError function:

const handler = nc({
  onError: (err, req, res, next) => {
    console.error(err.stack); // log error
    res.status(500).end("Something broke!"); // show a specific message
  },
})