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

Type error when integrating with nx composePlugins #9644

Closed
3 tasks done
ggarnier opened this issue Nov 23, 2023 · 2 comments
Closed
3 tasks done

Type error when integrating with nx composePlugins #9644

ggarnier opened this issue Nov 23, 2023 · 2 comments
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug

Comments

@ggarnier
Copy link

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/nextjs

SDK Version

7.80.1

Framework Version

Nextjs 14.0.1, nx 17.0.3

Link to Sentry event

No response

SDK Setup

I've followed the manual setup, because I'm using nx. The only difference was the Next.js configuration file. I tried to setup Sentry using nx composePlugins, like this:

const { composePlugins, withNx } = require('@nx/next');
const { withSentryConfig } = require('@sentry/nextjs');

const sentryWebpackPluginOptions = { /* my sentry configs */ };
const withSentry = (config) => withSentryConfig(config, sentryWebpackPluginOptions);
const plugins = [withNx, withSentry];

module.exports = composePlugins(...plugins)(nextConfig);

The plugin type, as expected by composePlugins, should implement this interface:

export interface NextPlugin {
    (config: NextConfig): NextConfig;
}

But withSentryConfig uses its own types, like ExportedNextConfig and NextConfigFunction, instead of NextConfig from Next.js.

Steps to Reproduce

Apply the configs from SDK Setup above.

Expected Result

It should work with the above config.

Actual Result

This type error:

Parameter 'config' implicitly has an 'any' type.ts(7006)
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Nov 23, 2023
@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Nov 23, 2023
@ggarnier
Copy link
Author

Related to #8982, but this is a specific type issue with the configs

@lforst
Copy link
Member

lforst commented Nov 23, 2023

Hi, this is not an issue with the SDK but the way you defined that function:

- const withSentry = (config) => withSentryConfig(config, sentryWebpackPluginOptions);
+ const withSentry = (config: NextConfig) => withSentryConfig(config, sentryWebpackPluginOptions);

Generally, our SDK does not aim to be compatible with Nx's composePlugins since it is a made up composition API that has nothing to do with Next.js itself.

@lforst lforst closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug
Projects
Archived in project
Development

No branches or pull requests

2 participants