Skip to content

@sentry/nextjs: can't read data inside next-compose-plugins #3579

Description

@Fadhilamadan

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node(raven for node)
  • other: @sentry/nextjs

Version:

"@sentry/nextjs": "^6.4.1",
"next": "^10.2.1",

Description

FYI: We start projects with version < 10.0.0 and then we are upgrading to the latest version.

Previously we have a setting in our next.config.js like this.

const withCss = require("@zeit/next-css");
const withSass = require("@zeit/next-sass");
const withPlugins = require("next-compose-plugins");
const withImages = require("next-images");
module.exports = withPlugins([withCss, withSass, withImages], {
env: {
SENTRY_DSN: "xxx",
}
});

Then we change the structure like in the documentation, become like this:

const { withSentryConfig } = require("@sentry/nextjs");
const withCss = require("@zeit/next-css");
const withSass = require("@zeit/next-sass");
const withPlugins = require("next-compose-plugins");
const withImages = require("next-images");
const moduleExports = withPlugins([withCss, withSass, withImages], {
env: {
SENTRY_DSN: "xxx",
}
});
// other codes
module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions);

When we run the app, env can't read with a struct like that. (start from this we are confused)

But, when we are changing the structure like this:

const { withSentryConfig } = require("@sentry/nextjs");
const moduleExports = {
env: {
SENTRY_DSN: "xxx",
}
};
// other codes
module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions);

The app can run fine, but the problem is we don't want to change like that because we are still using the next-compose-plugins.

Is there any recommendation for us, thank you.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions