Closed
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/nextjs
SDK Version
"@sentry/nextjs": "7.14.0"
Framework Version
"next": "12.3.1"
Link to Sentry event
https://sentry.io/organizations/doe-pars/issues/3634865618/?query=is%3Aunresolved
Steps to Reproduce
Enable the new autoInstrumentServerFunctions. Create a NextJS API route and set module.exports= apiName rather than using export default. I haven't tested it with an anonymous function.
Expected Result
The API route works and is instrumented by Sentry. Or at least I get a better error than the route mysteriously not working and no log messages.
Actual Result
TypeError
Cannot read properties of undefined (reading 'name')
From within Sentry's code:
/usr/src/app/node_modules/@sentry/nextjs/cjs/config/wrappers/withSentryAPI.js
Workaround for others who Google this:
Do an export default and name the function and it will work.