Skip to content

@sentry/next.js v 7.23.1 stops sending events #6475

Closed
@isaac-martin

Description

@isaac-martin

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/nextjs

SDK Version

7.23.0

Framework Version

7.23.0

Link to Sentry event

No response

Steps to Reproduce

After upgrading sentry to @sentry/next js to 7.23.1 we no longer get events sent.

this PR i believe is the culprit #6267 and looking at the code and the description that makes sense.

Our configs are below, and im wndering if its something in the ts-node register that is causing next to exclude the withSentryConfig from the bundle.

I also tried with just the sentry plugin and not using the next-compose-plugins and still was not able to send events

next.config.ts looks like the below

import NextBundleAnalyzer from "@next/bundle-analyzer";
import { withSentryConfig } from "@sentry/nextjs";
import { NextConfig } from "next";
import withPlugins from "next-compose-plugins";

import envVariables from "@brexhq/shared/utils/env/envVariables";
import { isDev } from "@brexhq/shared/utils/env/isDevEnv";

import { ensureEnvVariable } from "./src/utils/dataFetching/env";
import { getSanityToken } from "./src/utils/dataFetching/fetchFromSanity";






const nextConfig: NextConfig = {
  reactStrictMode: true,
  experimental: {
    externalDir: true,
  },
  sentry: {
    hideSourceMaps: true,
  },
  env: {
   ...
  },
  async headers() {
    return [...],
      },
    ];
  },
  async rewrites() {
    return [...];
  },
};

const sentryWebpackPluginOptions = {
  silent: true,
};

const bundleAnalyzer = process.env.ANALYZE
  ? NextBundleAnalyzer({
      enabled: process.env.ANALYZE === "true",
    })
  : (config: any) => config;

const sentry = withSentryConfig(nextConfig as any, sentryWebpackPluginOptions);

const images = {
  images: {
    remotePatterns: [
      {
        protocol: "https",
        hostname: "brand.brex.com",
        pathname: "/**",
        port: "",
      },
    ],
  },
};

module.exports = withPlugins([sentry, bundleAnalyzer, images]);

next.config.js is this which compiles the next.config.ts

require("ts-node").register({
  compilerOptions: {
    module: "commonjs",
    target: "es2017",
  },
});

require("tsconfig-paths/register");

module.exports = require("./next.config.ts");

Expected Result

Sentry sends events

Actual Result

No events are sent via sentry, and I observe no network calls being made.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions