Skip to content

Commit

Permalink
chore: update Sentry to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
chanceaclark committed Sep 13, 2024
1 parent c3d47a4 commit 41db4a9
Show file tree
Hide file tree
Showing 7 changed files with 8,237 additions and 3,448 deletions.
14 changes: 14 additions & 0 deletions instrumentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as Sentry from "@sentry/nextjs";

export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
await import("./sentry.server.config");
}

if (process.env.NEXT_RUNTIME === "edge") {
await import("./sentry.edge.config");
}
}

export const onRequestError = Sentry.captureRequestError;

39 changes: 2 additions & 37 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,20 @@ import { createRequire } from 'module';

const require = createRequire(import.meta.url);

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { withSentryConfig } = require('@sentry/nextjs');
const { withSentryConfig } = require("@sentry/nextjs");

/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,

/**
* If you have `experimental: { appDir: true }` set, then you must comment the below `i18n` config
* out.
*
* @see https://github.com/vercel/next.js/issues/41980
*/
i18n: {
locales: ['en'],
defaultLocale: 'en',
},
};

// Make sure adding Sentry options is the last code to run before exporting
export default withSentryConfig(
config,
{
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options

// Suppresses source map uploading logs during build
silent: true,

org: 'bigcommerce',
project: 'ai-app-foundation',
authToken: process.env.SENTRY_AUTH_TOKEN,
},
{
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/

// 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,

// 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,

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
}
);
Loading

0 comments on commit 41db4a9

Please sign in to comment.