From 8dedd81762b1a7f7a7e7d436fb83ee6e505c7a66 Mon Sep 17 00:00:00 2001 From: Andrey <44743245+andreysam@users.noreply.github.com> Date: Wed, 13 Sep 2023 12:24:30 +0300 Subject: [PATCH] fix(nextjs): Add selfhosted url in next.config.js (#438) adds the previously missing url paramter to the template if users are using self-hosted sentry Co-authored-by: Lukas Stracke --- CHANGELOG.md | 3 ++- src/nextjs/nextjs-wizard.ts | 2 ++ src/nextjs/templates.ts | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bc54787..b32f7970 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ ## Unreleased - enh(android): Show link to issues page after setup is complete (#448) - +- fix(nextjs): Add selfhosted url in `next.config.js` (#438) + ## 3.12.0 - feat(sourcemaps): Automatically insert Sentry Webpack plugin (#432) diff --git a/src/nextjs/nextjs-wizard.ts b/src/nextjs/nextjs-wizard.ts index bb2e7c32..61b62aef 100644 --- a/src/nextjs/nextjs-wizard.ts +++ b/src/nextjs/nextjs-wizard.ts @@ -118,6 +118,8 @@ export async function runNextjsWizard(options: WizardOptions): Promise { const sentryWebpackOptionsTemplate = getNextjsWebpackPluginOptionsTemplate( selectedProject.organization.slug, selectedProject.slug, + selfHosted, + sentryUrl, ); const sentryBuildOptionsTemplate = getNextjsSentryBuildOptionsTemplate(); diff --git a/src/nextjs/templates.ts b/src/nextjs/templates.ts index 719bca5b..1ea754ab 100644 --- a/src/nextjs/templates.ts +++ b/src/nextjs/templates.ts @@ -1,6 +1,8 @@ export function getNextjsWebpackPluginOptionsTemplate( orgSlug: string, projectSlug: string, + selfHosted: boolean, + url: string, ): string { return `{ // For all available options, see: @@ -8,9 +10,8 @@ export function getNextjsWebpackPluginOptionsTemplate( // Suppresses source map uploading logs during build silent: true, - org: "${orgSlug}", - project: "${projectSlug}", + project: "${projectSlug}",${selfHosted ? `\n url: "${url}"` : ''} }`; }