honeybadger-js icon indicating copy to clipboard operation
honeybadger-js copied to clipboard

Server side errors are not monitored correctly in NextJS app directory

Open mcAnastasiou opened this issue 2 years ago • 2 comments

What are the steps to reproduce this issue?

  1. Download current repository and run the nextJS app directory example
  2. Visit http://localhost:3000/data-fetching?fail=true

What happens?

In honeybadger you see the following error Screenshot 2023-06-28 at 14 59 20

Screenshot 2023-06-28 at 14 59 49

and on server logs Screenshot 2023-06-28 at 15 00 55

What were you expecting to happen?

The error should display the source code instead. Have tested the same behavior in Sentry and it works fine.

Any other comments?

It seems that before notify is not being executed in honeybadger.server.config.js. I added a console log and nothing is being displayed in the console. Probably this is the place that it handles the source map

Current behavior cannot be used in production, because the line code as you can see in the screenshot, is the one in production javascript file and not the source one. This makes it impossible to debug it when an error occurs

mcAnastasiou avatar Jun 28 '23 12:06 mcAnastasiou

Hey @mcAnastasiou,

Thanks for testing this out!

Indeed, Next.js by default replaces the real error message with a generic one for better security when reporting a server error. You can use the digest field to find the error message in your server's logs. Obviously, this is not ideal.

I think Sentry uses a different approach in catching and reporting errors, and all of this should be tackled with #1055.

subzero10 avatar Jun 29 '23 05:06 subzero10

Hey @mcAnastasiou,

Thanks for testing this out!

Indeed, Next.js by default replaces the real error message with a generic one for better security when reporting a server error. You can use the digest field to find the error message in your server's logs. Obviously, this is not ideal.

I think Sentry uses a different approach in catching and reporting errors, and all of this should be tackled with #1055.

Thank you! i will subscribe to that issue

mcAnastasiou avatar Jun 29 '23 08:06 mcAnastasiou