Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
10.55.0
Framework Version
next@16.2.6
Link to Sentry event
https://the-lego-group.sentry.io/issues/124672262/?environment=dev&query=is%3Aunresolved&referrer=issue-stream
Reproduction Example/SDK Setup
I have followed the setup guide for Sentry with Next.js, and can confirm error capturing works in both client and server logic. However, when attempting to add pino integration, I run into a peculiar error:
Export pinoIntegration doesn't exist in target module
> 3 | import { init, type LogSeverityLevel, pinoIntegration } from '@sentry/nextjs';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
instrumentation.ts file:
import { getLogger } from '@bricklink/utils/server';
import { captureRequestError } from '@sentry/nextjs';
import type { Instrumentation } from 'next';
export async function register() {
switch (process.env.NEXT_RUNTIME) {
case 'nodejs':
await import('./sentry.server.config');
break;
case 'edge':
throw new Error('Edge runtime is currently not supported');
}
}
export const onRequestError: Instrumentation.onRequestError = (err, request, context) => {
captureRequestError(err, request, context);
// NOTE: Request may contain sensitive information in headers, so we only retain information that is guaranteed to not
// contain sensitive information for logging purposes.
const safeRequest = request
? {
method: request.method,
path: request.path,
}
: undefined;
getLogger('portal.instrumentation-server').error(
{ correlationId: crypto.randomUUID(), err, request: safeRequest, context },
'Internal server error',
);
};
sentry.server.config.ts file:
import { init } from '@sentry/nextjs';
import { pinoIntegration } from '@sentry/node-core';
init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
environment: 'dev',
sendDefaultPii: true,
tracesSampleRate: 0.1,
enableLogs: true,
integrations: [
pinoIntegration({
log: { levels: ['trace', 'debug', 'info', 'warn'] },
error: { levels: ['error', 'fatal'] },
}),
],
});
Steps to Reproduce
- Attempting to import
pinoIntegration from @sentry/nextjs will result in an error being thrown when attempting to serve the app
- Removing the import for
pinoIntegration will resolve the issue
- Alternatively, swapping the import so that
pinoIntegration is imported from @sentry/node-core also works
Expected Result
The typing for @sentry/nextjs suggests that pinoIntegration is available, but it is not. There is no type errors when attempting to import it, but it fails with a runtime error.
Actual Result
Importing pinoIntegration from @sentry/nextjs should not throw a runtime error.
Additional Context
I tried using Claude Code to debug it, and it reports back with this finding:
pinoIntegration is re-exported by @sentry/nextjs at CJS runtime (which is why node -e finds it) but it's missing from the static ESM export map, so the bundler can't resolve it as a named export. Importing directly from @sentry/node-core — which is a peer dep already in the tree at the same version (10.55.0) — avoids the missing-export error while keeping the same function.
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
10.55.0
Framework Version
next@16.2.6
Link to Sentry event
https://the-lego-group.sentry.io/issues/124672262/?environment=dev&query=is%3Aunresolved&referrer=issue-stream
Reproduction Example/SDK Setup
I have followed the setup guide for Sentry with Next.js, and can confirm error capturing works in both client and server logic. However, when attempting to add pino integration, I run into a peculiar error:
instrumentation.ts file:
sentry.server.config.ts file:
Steps to Reproduce
pinoIntegrationfrom@sentry/nextjswill result in an error being thrown when attempting to serve the apppinoIntegrationwill resolve the issuepinoIntegrationis imported from@sentry/node-corealso worksExpected Result
The typing for
@sentry/nextjssuggests thatpinoIntegrationis available, but it is not. There is no type errors when attempting to import it, but it fails with a runtime error.Actual Result
Importing
pinoIntegrationfrom@sentry/nextjsshould not throw a runtime error.Additional Context
I tried using Claude Code to debug it, and it reports back with this finding:
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it.