question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
Sm1tcommented, Jun 8, 2021

@AbhiPrasad hi, it looks like SentryWebpackPluginOptions is being ignored when using withSentryConfig inside withPlugins. Reproduction:

const { withSentryConfig } = require('@sentry/nextjs');
const withPlugins = require('next-compose-plugins');

const SentryWebpackPluginOptions = {
  release: 'qwe',
  dryRun: false,
};

module.exports = withPlugins(
  [[withSentryConfig, SentryWebpackPluginOptions]],
  {}
);
  • yarn dev
  • release still “development” (terminal: [Sentry Webpack Plugin] Finalizing release: ‘development’), uploading source maps to Sentry was not called

When using withSentryConfig outside of plugins, as in the example above, SentryWebpackPluginOptions works as expected - release ‘qwe’, loading source maps into Sentry was called (terminal: ‘Authentication credentials were not provided’, as expected)

const { withSentryConfig } = require('@sentry/nextjs');
const withPlugins = require('next-compose-plugins');

const SentryWebpackPluginOptions = {
  release: 'qwe',
  dryRun: false,
};

module.exports = withPlugins(
  [],
  withSentryConfig({}, SentryWebpackPluginOptions)
);
2reactions
lobsterkatiecommented, Apr 4, 2022

Unfortunately all of our resources this quarter have been aimed at getting our new major out the door, so I haven’t gotten a chance to work on this any more.

(I’m sorry - I know that’s not a super satisfying answer. Once the major’s out, I can bring this up again with the team.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

sentry/nextjs: can't read data inside next-compose-plugins
sentry /nextjs: can't read data inside next-compose-plugins.
Read more >
Manual Setup for Next.js - Sentry Documentation
Learn how to set up the SDK manually.
Read more >
Failed to load next.config.js - Stack Overflow
If you build the repository inside a different environment, where a different Node.js version is referenced (e.g. in Webstorm vs. a separate ...
Read more >
sassoptions nextjs | The AI Search Engine You Control
If you want to configure the Sass compiler, use sassOptions in next.config.js. const path = require ('path'); module. exports = {sassOptions: {includePaths: ...
Read more >
How to Start Using Sentry: Application Monitoring for Next.js
I use Sentry in a few different applications so I thought I'd show you how you can implement this in Next.jsFollow me on:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found