Description
- 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/nextjs
Version:
6.11.0
Description
I was unable to get error reporting from API endpoints deployed in Vercel (as serverless functions) with @sentry/nextjs
version 6.11.0 but downgrading to 6.4.1 fixed in.
Our app is a new one built with Next.js 11.1 from create-next-app
as of last week.
We used the latest @sentry/nextjs
configured according to the documentation, and with additional changes following the with-sentry example: specifically, added _error.js page and err
pass through to <Component/>
in _app.js.
Before downgrading, client errors were logged fine but I couldn't get error reports from Vercel serverless functions at all.
Both client- and server-side errors were logged successfully to Sentry when running the project locally with yarn dev
.
This is the failing API endpoint I used to test in file pages/api/boom.js:
import { withSentry } from "@sentry/nextjs";
const handler = async function handler(req, res) {
// Trigger an exception
boom();
res.status(200).send("OK");
};
export default withSentry(handler);
The problem seems similar to other reported issues:
- @sentry/nextjs not reporting issues i serverless functions #3643 (closed at time of writing, otherwise I would have commented there instead)
- Next.js package does not report server and some client errors #3869 (open at time of writing; seemingly fixed, but does not mention API routes)