Title: Sentry with async function nextConfig not working · Issue #7444 · getsentry/sentry-javascript · GitHub
Open Graph Title: Sentry with async function nextConfig not working · Issue #7444 · getsentry/sentry-javascript
X Title: Sentry with async function nextConfig not working · Issue #7444 · getsentry/sentry-javascript
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.co...
Open Graph 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 wit...
X 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 wit...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/7444
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sentry with async function nextConfig not working","articleBody":"### Discussed in https://github.com/getsentry/sentry-javascript/discussions/7433\r\n\r\n\u003cdiv type='discussions-op-text'>\r\n\r\n\u003csup>Originally posted by **Supermog** March 13, 2023\u003c/sup>\r\nSo 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:\r\n```\r\nconst { withSentryConfig } = require('@sentry/nextjs');\r\n\r\nconst prismic = require('@prismicio/client');\r\n\r\nconst sm = require('./sm.json');\r\n\r\n/** @type {import('next').NextConfig} */\r\nconst nextConfig = async () => {\r\n const client = prismic.createClient(sm.apiEndpoint);\r\n\r\n const repository = await client.getRepository();\r\n const locales = repository.languages.map(lang => lang.id);\r\n\r\n return {\r\n reactStrictMode: true,\r\n swcMinify: true,\r\n compiler: {\r\n styledComponents: true,\r\n },\r\n i18n: {\r\n // These are all the locales you want to support in\r\n // your application\r\n locales: locales,\r\n // This is the default locale you want to be used when visiting\r\n // a non-locale prefixed path e.g. `/hello`\r\n defaultLocale: locales[0],\r\n localeDetection: false,\r\n },\r\n };\r\n};\r\n\r\nmodule.exports = withSentryConfig(\r\n nextConfig,\r\n { silent: true },\r\n { hideSourcemaps: true },\r\n);\r\n```\r\n\r\nI'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.\r\nWithout Sentry it works well because nextjs accepts nextConfig as an async function but Sentry does not. Is there a workaround to this?\r\n\r\n\"@sentry/nextjs\": \"^7.42.0\",\r\n\"next\": \"13.1.2\",\r\n\"react\": \"18.2.0\",\r\n\u003c/div>","author":{"url":"https://github.com/AbhiPrasad","@type":"Person","name":"AbhiPrasad"},"datePublished":"2023-03-13T17:56:26Z","url":"https://github.com/getsentry/sentry-javascript/issues/7444"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6dbf82d4-7045-aefd-1be8-1ff909c8579f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A31A:D7239:171DFA:20BE2B:6B0466E4 |
| html-safe-nonce | dc3e98b4840f63d586391a5cf8053b750d688674107e9201809173bee47b0409 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzFBOkQ3MjM5OjE3MURGQToyMEJFMkI6NkIwNDY2RTQiLCJ2aXNpdG9yX2lkIjoiMTk0NjEwNDYzMjQwMzgyMTgwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | cb084edb23b59c709e54dc92278fd81b44a1913b48ac7bb70af05ce047215d75 |
| hovercard-subject-tag | issue:1621978624 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/7444/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6b544ca8bcdc2df09d3df18b2c3dd91ae51fe79339b682ab9b533a119a6419c2/getsentry/sentry-javascript/issues/7444 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6b544ca8bcdc2df09d3df18b2c3dd91ae51fe79339b682ab9b533a119a6419c2/getsentry/sentry-javascript/issues/7444 |
| og:image:alt | 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 wit... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AbhiPrasad |
| hostname | github.com |
| expected-hostname | github.com |
| None | 83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ca4d07a7cef4e4b75f821dc25e7300d80c1450a9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width