-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Package: nextjsIssues related to the Sentry Nextjs SDKIssues related to the Sentry Nextjs SDK
Description
Discussed in #7433
Originally posted by Supermog March 13, 2023
So I have a project that I added Sentry to, but the problem is that I have the nextConfig variable as an async function which the withSentryConfig doesn't accept. My next.config.js file looks like this:
const { withSentryConfig } = require('@sentry/nextjs');
const prismic = require('@prismicio/client');
const sm = require('./sm.json');
/** @type {import('next').NextConfig} */
const nextConfig = async () => {
const client = prismic.createClient(sm.apiEndpoint);
const repository = await client.getRepository();
const locales = repository.languages.map(lang => lang.id);
return {
reactStrictMode: true,
swcMinify: true,
compiler: {
styledComponents: true,
},
i18n: {
// These are all the locales you want to support in
// your application
locales: locales,
// This is the default locale you want to be used when visiting
// a non-locale prefixed path e.g. `/hello`
defaultLocale: locales[0],
localeDetection: false,
},
};
};
module.exports = withSentryConfig(
nextConfig,
{ silent: true },
{ hideSourcemaps: true },
);
I've also played around with it and using await on the nextConfig argument or calling the function also does not work. I've tried converting it to .then blocks but that also does not work.
Without Sentry it works well because nextjs accepts nextConfig as an async function but Sentry does not. Is there a workaround to this?
"@sentry/nextjs": "^7.42.0",
"next": "13.1.2",
"react": "18.2.0",
nabusman
Metadata
Metadata
Assignees
Labels
Package: nextjsIssues related to the Sentry Nextjs SDKIssues related to the Sentry Nextjs SDK