Skip to content

TypeError: withSentryConfig is not a function #10627

@CodeNameNinja

Description

@CodeNameNinja

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

7.100.1

Framework Version

Next 13.5.4

Link to Sentry event

No response

SDK Setup

// This file configures the initialization of Sentry on the client.
// The config you add here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from "@sentry/nextjs";

Sentry.init({
dsn: "XXX",

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

replaysOnErrorSampleRate: 1.0,

// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,

// You can remove this option if you're not planning to use the Sentry Session Replay feature:
integrations: [
Sentry.replayIntegration({
// Additional Replay configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
Sentry.feedbackIntegration({
// Additional SDK configuration goes in here, for example:
colorScheme: "light",
}),
],
});

Steps to Reproduce

I followed the guide for nextjs sentry

npx @sentry/wizard@latest -i nextjs

after running yarn dev

I get hit with the following error

TypeError: withSentryConfig is not a function
    at eval (./next.config.js:3:18)
    at (ssr)/./next.config.js (/Users/mitchellyuen/Documents/Work/Micro-Service-Ticketing/apps/frontend/clientv2/.next/server/app/page.js:455:1)
    at __webpack_require__ (/Users/mitchellyuen/Documents/Work/Micro-Service-Ticketing/apps/frontend/clientv2/.next/server/webpack-runtime.js:33:43)
    at eval (./src/auth/context/jwt/auth-provider.tsx:7:69)
    at (ssr)/./src/auth/context/jwt/auth-provider.tsx (/Users/mitchellyuen/Documents/Work/Micro-Service-Ticketing/apps/frontend/clientv2/.next/server/app/page.js:895:1)
    at __webpack_require__ (/Users/mitchellyuen/Documents/Work/Micro-Service-Ticketing/apps/frontend/clientv2/.next/server/webpack-runtime.js:33:43)
  1 | const { withSentryConfig } = require("@sentry/nextjs");
  2 | 
> 3 | module.exports = withSentryConfig(
    |                 ^
  4 |   {
  5 |     trailingSlash: true,
  6 |     modularizeImports: {

I have tried a clean install, removed node_modules and ran yarn install, same result

Expected Result

Should not have the mentioned error, app should compile and run fine

Actual Result

 ⨯ next.config.js (3:17) @ withSentryConfig
 ⨯ TypeError: withSentryConfig is not a function
    at eval (./next.config.js:3:18)
    at (ssr)/./next.config.js (/Users/mitchellyuen/Documents/Work/Micro-Service-Ticketing/apps/frontend/clientv2/.next/server/app/page.js:455:1)
    at __webpack_require__ (/Users/mitchellyuen/Documents/Work/Micro-Service-Ticketing/apps/frontend/clientv2/.next/server/webpack-runtime.js:33:43)
    at eval (./src/auth/context/jwt/auth-provider.tsx:7:69)
    at (ssr)/./src/auth/context/jwt/auth-provider.tsx (/Users/mitchellyuen/Documents/Work/Micro-Service-Ticketing/apps/frontend/clientv2/.next/server/app/page.js:895:1)
    at __webpack_require__ (/Users/mitchellyuen/Documents/Work/Micro-Service-Ticketing/apps/frontend/clientv2/.next/server/webpack-runtime.js:33:43)
  1 | const { withSentryConfig } = require("@sentry/nextjs");
  2 | 
> 3 | module.exports = withSentryConfig(
    |                 ^
  4 |   {
  5 |     trailingSlash: true,
  6 |     modularizeImports: {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions