Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
3 tasks done
isaac-martin opened this issue Dec 8, 2022 · 2 comments
Closed
3 tasks done

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

isaac-martin opened this issue Dec 8, 2022 · 2 comments

Comments

@isaac-martin
Copy link

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.

@lforst
Copy link
Member

lforst commented Dec 8, 2022

Hi, is this just affecting next dev or also next build && next start? Also, the newer versions of the SDK are most likely not compatible with next-compose-plugins, since that package doesn't respect the fact that next configurations can return functions (which withSentryConfig does out of necessity).

Edit: Some subjective and unasked-for opinions. Looking at next-compose-plugins, I really recommend not using it anymore. It got updated last two years ago and it's only a matter of time until it causes more problems.

@isaac-martin
Copy link
Author

Yeah i actually found this issue and was able to solve based on the content in here.

#6447

Thanks for the response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants