From 43c479b6945edccc49f0fa5d901943624a548aef Mon Sep 17 00:00:00 2001 From: SandipBajracharya Date: Wed, 20 Aug 2025 17:27:29 +0545 Subject: [PATCH 1/4] debug(OUT-2191): log info about the attempts to get token --- src/utils/token.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/token.ts b/src/utils/token.ts index 773b6df..50e45a7 100644 --- a/src/utils/token.ts +++ b/src/utils/token.ts @@ -1,5 +1,5 @@ export const getTokenWithRetry = async ( - maxRetries = 3, + maxRetries = 5, delayMs = 250, ): Promise => { if (typeof document === 'undefined') { @@ -8,6 +8,8 @@ export const getTokenWithRetry = async ( for (let attempt = 0; attempt < maxRetries; attempt++) { const token = new URLSearchParams(document.location?.search).get('token') + console.info(`Attempt ${attempt} to get token: ${token}`) + if (token) { return token } From 6947d925675f64ac25567c7fbb08a8d689247959 Mon Sep 17 00:00:00 2001 From: SandipBajracharya Date: Fri, 22 Aug 2025 15:02:06 +0545 Subject: [PATCH 2/4] add(OUT-2191): sentry source map for easy debugging --- next.config.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/next.config.js b/next.config.js index d49b12b..5e554ef 100644 --- a/next.config.js +++ b/next.config.js @@ -60,5 +60,10 @@ module.exports = withSentryConfig( // https://docs.sentry.io/product/crons/ // https://vercel.com/docs/cron-jobs automaticVercelMonitors: true, + + // maps errors to exact release. Vercel automatically exposes VERCEL_GIT_COMMIT_SHA environment variables during the build process. + release: process.env.VERCEL_GIT_COMMIT_SHA, + include: '.next', // 👈 Upload sourcemaps from Next.js build + ignore: ['node_modules'], // exclude noisy files }, ) From b458ffc2d4f16152965e1b58a7875e8ba024ede5 Mon Sep 17 00:00:00 2001 From: SandipBajracharya Date: Fri, 22 Aug 2025 15:27:49 +0545 Subject: [PATCH 3/4] update(OUT-2191): update next.config file with sentry setup --- next.config.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/next.config.js b/next.config.js index 5e554ef..df51a92 100644 --- a/next.config.js +++ b/next.config.js @@ -20,13 +20,11 @@ const nextConfig = { }, } -module.exports = nextConfig - // SENTRY CONFIG const { withSentryConfig } = require('@sentry/nextjs') module.exports = withSentryConfig( - module.exports, + nextConfig, { // For all available options, see: // https://github.com/getsentry/sentry-webpack-plugin#options @@ -35,6 +33,11 @@ module.exports = withSentryConfig( silent: true, org: process.env.NEXT_PUBLIC_SENTRY_ORG, project: process.env.NEXT_PUBLIC_SENTRY_PROJECT, + // maps errors to exact release. Vercel automatically exposes VERCEL_GIT_COMMIT_SHA environment variables during the build process. + release: process.env.VERCEL_GIT_COMMIT_SHA, + include: '.next', // 👈 Upload sourcemaps from Next.js build + ignore: ['node_modules'], // exclude noisy files + urlPrefix: '~/_next', }, { // For all available options, see: @@ -60,10 +63,5 @@ module.exports = withSentryConfig( // https://docs.sentry.io/product/crons/ // https://vercel.com/docs/cron-jobs automaticVercelMonitors: true, - - // maps errors to exact release. Vercel automatically exposes VERCEL_GIT_COMMIT_SHA environment variables during the build process. - release: process.env.VERCEL_GIT_COMMIT_SHA, - include: '.next', // 👈 Upload sourcemaps from Next.js build - ignore: ['node_modules'], // exclude noisy files }, ) From 3c148674db867fa3173c6a4953ee7cf27d465e25 Mon Sep 17 00:00:00 2001 From: SandipBajracharya Date: Fri, 22 Aug 2025 15:35:07 +0545 Subject: [PATCH 4/4] fix(OUT-2191): update next config for sentry --- next.config.js | 58 ++++++++++++++++++++------------------------------ 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/next.config.js b/next.config.js index df51a92..f0cc8e5 100644 --- a/next.config.js +++ b/next.config.js @@ -23,45 +23,33 @@ const nextConfig = { // SENTRY CONFIG const { withSentryConfig } = require('@sentry/nextjs') -module.exports = withSentryConfig( - nextConfig, - { - // For all available options, see: - // https://github.com/getsentry/sentry-webpack-plugin#options +module.exports = withSentryConfig(nextConfig, { + // For all available options, see: + // https://github.com/getsentry/sentry-webpack-plugin#options - // Suppresses source map uploading logs during build - silent: true, - org: process.env.NEXT_PUBLIC_SENTRY_ORG, - project: process.env.NEXT_PUBLIC_SENTRY_PROJECT, - // maps errors to exact release. Vercel automatically exposes VERCEL_GIT_COMMIT_SHA environment variables during the build process. - release: process.env.VERCEL_GIT_COMMIT_SHA, - include: '.next', // 👈 Upload sourcemaps from Next.js build - ignore: ['node_modules'], // exclude noisy files - urlPrefix: '~/_next', - }, - { - // For all available options, see: - // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ + // Suppresses source map uploading logs during build + silent: !process.env.CI, + org: process.env.NEXT_PUBLIC_SENTRY_ORG, + project: process.env.NEXT_PUBLIC_SENTRY_PROJECT, - // Upload a larger set of source maps for prettier stack traces (increases build time) - widenClientFileUpload: true, + // Upload a larger set of source maps for prettier stack traces (increases build time) + widenClientFileUpload: true, - // Transpiles SDK to be compatible with IE11 (increases bundle size) - transpileClientSDK: true, + // Transpiles SDK to be compatible with IE11 (increases bundle size) + transpileClientSDK: true, - // Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load) - tunnelRoute: '/monitoring', + // Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load) + tunnelRoute: '/monitoring', - // Hides source maps from generated client bundles - hideSourceMaps: true, + // Hides source maps from generated client bundles + hideSourceMaps: true, - // Automatically tree-shake Sentry logger statements to reduce bundle size - disableLogger: true, + // Automatically tree-shake Sentry logger statements to reduce bundle size + disableLogger: true, - // Enables automatic instrumentation of Vercel Cron Monitors. - // See the following for more information: - // https://docs.sentry.io/product/crons/ - // https://vercel.com/docs/cron-jobs - automaticVercelMonitors: true, - }, -) + // Enables automatic instrumentation of Vercel Cron Monitors. + // See the following for more information: + // https://docs.sentry.io/product/crons/ + // https://vercel.com/docs/cron-jobs + automaticVercelMonitors: true, +})