Skip to content

Commit

Permalink
fix: sentry proxy tunnels through CDN_URI (#1408)
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity authored Sep 6, 2024
1 parent 7397337 commit c58f70b
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions packages/ui/docs-bundle/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const DOCS_FILES_ALLOWLIST = [
},
];

const DOCS_FILES_URLS = DOCS_FILES_ALLOWLIST.map(
({ protocol, hostname, port }) => `${protocol}://${hostname}${port ? `:${port}` : ""}`,
);
// const DOCS_FILES_URLS = DOCS_FILES_ALLOWLIST.map(
// ({ protocol, hostname, port }) => `${protocol}://${hostname}${port ? `:${port}` : ""}`,
// );

function isTruthy(value) {
if (value == null) {
Expand Down Expand Up @@ -303,6 +303,16 @@ module.exports = withBundleAnalyzer(nextConfig);

const { withSentryConfig } = require("@sentry/nextjs");

let sentryTunnelRoute = "/api/fern-docs/monitoring";

if (isTruthy(process.env.TRAILING_SLASH)) {
sentryTunnelRoute += "/";
}

if (cdnUri != null) {
sentryTunnelRoute = new URL(sentryTunnelRoute, cdnUri).pathname;
}

module.exports = withSentryConfig(
module.exports,
{
Expand All @@ -328,10 +338,10 @@ module.exports = withSentryConfig(
// This can increase your server load as well as your hosting bill.
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
tunnelRoute: "/api/fern-docs/monitoring",
tunnelRoute: sentryTunnelRoute,

// Hides source maps from generated client bundles
hideSourceMaps: true,
hideSourceMaps: !isTruthy(process.env.ENABLE_SOURCE_MAPS),

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
Expand Down

0 comments on commit c58f70b

Please sign in to comment.