@sentry/nextjs not reporting issues i serverless functions
See original GitHub issue- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Package + Version
-
@sentry/browser
-
@sentry/node
-
raven-js
-
raven-node
(raven for node) - other:
Version:
6.5.1
Description
I’ve recently started using the @sentry/nextjs
package for a Nextjs site. I’ve followed through with the installation guide with one exception. I’m using environment variables instead of the file generated by the wizard. On the client side it works great, the releases and bugs are being tracked, but I’m getting no reports from my serveless functions when they throw errors.
import { withSentry } from "@sentry/nextjs";
const handler = async (req, res) => {
throw new Error("API throw error test");
res.status(200).json({ name: "John Doe" });
};
export default withSentry(handler);
This is the serverless function I am testing and nothing is showing up in my Sentry dashboard when it fails.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:28 (12 by maintainers)
Top Results From Across the Web
Troubleshooting for Next.js - Sentry Documentation
If your application started to misbehave because of performing additional OPTIONS requests, it is most likely an issue with unwanted sentry-trace request ...
Read more >@sentry/node | Yarn - Package Manager
Official Sentry SDK for Node.js ... feat(nextjs): Check for Vercel Edge Function GA (#6565); feat(utils): Improved envelope parser (#6580); fix(nextjs): ...
Read more >Sessions | Sentry Developer Documentation
Session updates must not change the attributes or data corrupts when ... crashed : a session should be reported as crashed under the...
Read more >Using Next.js' middleware and Edge Functions - LogRocket Blog
Middleware is a Next.js feature that solves basic problems like authentication and geolocation with the help of Vercel Edge Functions.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey everyone, thanks for all the comments and feedback.
We are currently working on a patch to fix these issues (and some of the linked issues) by changing how we do server side initialisation of the Sentry SDK - we hope to push something out ASAP.
For context: we had this issue when we first manually integrated Sentry with Vercel (before the Next.js plugin). The issue, as I remember, is that Sentry queues up exceptions to be sent to the server but Vercel terminates the function instantaneously — causing the exception to be lost.
Adding
await Sentry.flush(2000)
to the error path fixed the issue, the Next.js library should probably do that by default.