sentry-javascript: `logger.info` is not a function

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/nextjs

SDK Version

7.27.0

Framework Version

Next 13.0.6 + React 18.2.0

Link to Sentry event

No response

Steps to Reproduce

We have tunnelRoute set to a Next.js API rewrite route.

const uploadSourceMaps =
  process.env.VERCEL_ENV === "production" || process.env.VERCEL_GIT_COMMIT_REF === "main";
const enableSentryTunneling = !!process.env.NEXT_PUBLIC_SENTRY_DSN;
nextConfig = {
  // ...
  sentry: {
    widenClientFileUpload: true,
    hideSourceMaps: true,
    disableServerWebpackPlugin: !uploadSourceMaps,
    disableClientWebpackPlugin: !uploadSourceMaps,
    tunnelRoute: enableSentryTunneling ? "/sentry" : undefined,
  },
  // ...
}
// ...
nextConfig = withSentryConfig(nextConfig, {
  silent: false,
  ignore: [],
});

Unfortunately, this is a user-reported error and we’re not able to reproduce it easily ourselves. We’re running off of a video the user recorded and sent to us.

Expected Result

Our page does not crash because of an error within the Sentry SDK.

Actual Result

We are seeing the following error: m.kg.info is not a function from the following code in the minified bundle:

(\"undefined\"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&m.kg.info(`Tunneling events to \"${o}\"`)

Which is this logger.info call: https://github.com/getsentry/sentry-javascript/pull/6425/files#diff-c2cfa1982aa65a588417425b73b5681acae750306871f81efeed3ef3f0d2a4b7R21

CleanShot 2022-12-21 at 09 41 17

We are enabling tree-shaking now to see if that works around this issue, however I wouldn’t have expected this to crash.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Ok cli and webpack-plugin shouldn’t matter. Honestly this is weird and I don’t know why this is happening. My best bet right now is that swc is somehow mangling the field names. I don’t think there is anything we can do here right now. If you figure something out, let me know. I will monitor if this affects more people and escalate if necessary.

To avoid logger.info, my current resolution is to set __SENTRY_DEBUG__ to false.

Ok cli and webpack-plugin shouldn’t matter. Honestly this is weird and I don’t know why this is happening. My best bet right now is that swc is somehow mangling the field names. I don’t think there is anything we can do here right now. If you figure something out, let me know. I will monitor if this affects more people and escalate if necessary.

I am having this issue as well.