sentry-javascript
sentry-javascript copied to clipboard
TypeError: withSentryConfig is not a function
Is there an existing issue for this?
- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [X] I have reviewed the documentation https://docs.sentry.io/
- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
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: {
Hi, thanks for writing in. Would you mind sharing a reproduction repo we can pull to debug this further?
Also, are you importing your next.config.js file from your application code? If so, the SDK doesn't support that use case. You would need to extract the thing you're trying to import into another file and import it from next.config.js
.
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀