Skip to content

Type error when integrating with nx composePlugins #9644

Closed as not planned
Closed as not planned
@ggarnier

Description

@ggarnier

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Type

    No type

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions