Hey @r.lal! I think you have a bit of a tough issue here that hasn’t been seen too frequently, hence the long response time on your question from the community in doing research on my end, I’ve only seen the issue of unhandled promise rejections not being recorded brought up one other time. Let me pass on some of the info I found:
The Browser agent doesn’t record unhandled promise rejections automatically - this was true as of about 1.5 years ago and I haven’t been able to find anything that suggests that this behavior has changed. As I understand it, this was an intentional decision to ensure performance quality stays at maximum.
The noticeError API call is the solution - Since we don’t collect unhandled promise rejections automatically, we do suggest using the API call.
One thing I also wanted to mention was your comment here:
I have tried adding my own listener (via
window.addEventListener("unhandledrejection ) to then call
noticeError however it seems NewRelic is wrapping this listener, console logging the error but then doing nothing with the error after that.
It’s interesting you mention that the agent is also logging the error to the console, this isn’t typical behavior that I’ve observed and doesn’t really make sense why we would be adding extra noise to the console for every error that’s recorded.
Could you try moving the noticeError API call directly into the logic for the promise, so that as soon as it’s determined that it’s rejected the API call is made? That way you won’t have to go the route of catching it after the fact with an event listener and instead record it at the same time it happens.
Let us know your results or if you have any questions!