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 'ProfilingIntegration' is not assignable to type 'Integration' #10852

Closed
3 tasks done
srujun opened this issue Feb 29, 2024 · 10 comments
Closed
3 tasks done

Type 'ProfilingIntegration' is not assignable to type 'Integration' #10852

srujun opened this issue Feb 29, 2024 · 10 comments
Labels
Package: node Issues related to the Sentry Node SDK Stale Type: Bug

Comments

@srujun
Copy link

srujun commented Feb 29, 2024

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

7.103.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

Sentry.init({
    dsn,
    environment,
    tracesSampleRate,
    profilesSampleRate: 1.0,
    enabled: !config.isDev && !config.isTest,
    maxValueLength: 0,
    integrations: [
      new Sentry.Integrations.Http({ tracing: true }),
      new Sentry.Integrations.Express({
        app: expressApp,
      }),
      new ProfilingIntegration(),
      new Sentry.Integrations.GraphQL(),
      new Sentry.Integrations.Prisma({ client: prismaClient }),
      new Sentry.Integrations.Postgres()
    ]
  })

Steps to Reproduce

This error is happening within a typescript project. It seems the @sentry/profiling-node package depends on an older version of @sentry/node or @sentry/types.

Expected Result

No compile error

Actual Result

I get this error:

Type 'ProfilingIntegration' is not assignable to type 'Integration'.
  Types of property 'setupOnce' are incompatible.
    Type '(addGlobalEventProcessor: (callback: import(".../@sentry/types/types/eventprocessor").EventProcessor) => void, getCurrentHub: () => import(".../node_modules/@sentry/types/types/hub").Hub) => void' is not assignable to type '(addGlobalEventProcessor: (callback: import(".../node_modules/@sentry/node/node_modules/@sentry/types/types/eventprocessor").EventProcessor) => void, getCurrentHub: () => import(".../node_modules/@sentry/node/node_modules/@sentry/types/types/hub").Hub) => void'.
      Types of parameters 'addGlobalEventProcessor' and 'addGlobalEventProcessor' are incompatible.
        Types of parameters 'callback' and 'callback' are incompatible.
          Type 'import(".../node_modules/@sentry/types/types/eventprocessor").EventProcessor' is not assignable to type 'import(".../node_modules/@sentry/node/node_modules/@sentry/types/types/eventprocessor").EventProcessor'.
            Types of parameters 'hint' and 'hint' are incompatible.
              Type 'import(".../node_modules/@sentry/node/node_modules/@sentry/types/types/event").EventHint' is not assignable to type 'import(".../node_modules/@sentry/types/types/event").EventHint'.
                Types of property 'captureContext' are incompatible.
                  Type 'import(".../node_modules/@sentry/node/node_modules/@sentry/types/types/scope").CaptureContext | undefined' is not assignable to type 'import(".../node_modules/@sentry/types/types/scope").CaptureContext | undefined'.
                    Type 'Scope' is not assignable to type 'CaptureContext | undefined'.
                      Type 'import(".../node_modules/@sentry/node/node_modules/@sentry/types/types/scope").Scope' is not assignable to type 'import(".../node_modules/@sentry/types/types/scope").Scope'.
                        Types of property 'update' are incompatible.
                          Type '(captureContext?: import(".../node_modules/@sentry/node/node_modules/@sentry/types/types/scope").CaptureContext | undefined) => import(".../node_modules/@sentry/node/node_modules/@sentry/types/types/scope").Scope' is not assignable to type '(captureContext?: import(".../node_modules/@sentry/types/types/scope").CaptureContext | undefined) => import(".../node_modules/@sentry/types/types/scope").Scope'.
                            Types of parameters 'captureContext' and 'captureContext' are incompatible.
                              Type 'import(".../node_modules/@sentry/types/types/scope").CaptureContext | undefined' is not assignable to type 'import(".../node_modules/@sentry/node/node_modules/@sentry/types/types/scope").CaptureContext | undefined'.
                                Type 'Scope' is not assignable to type 'CaptureContext | undefined'.
                                  Type 'Scope' is missing the following properties from type 'Scope': setClient, getClient, getScopeData, captureException, and 2 more.ts(2322)
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 2 Feb 29, 2024
@github-actions github-actions bot added the Package: node Issues related to the Sentry Node SDK label Feb 29, 2024
@mydea
Copy link
Member

mydea commented Feb 29, 2024

Hello! Are your versions in lockstep - meaning you also have @sentry/profiling-node version 7.103.0? That is required for this to work as expected!

@srujun
Copy link
Author

srujun commented Feb 29, 2024

Yes my package.json is using the same versions for both:

    "@sentry/node": "^7.103.0",
    "@sentry/profiling-node": "^7.103.0",

I'm guessing the issue is here:

@sentry/profiling-node depends on an older version of @sentry/types.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 2 Feb 29, 2024
@mydea
Copy link
Member

mydea commented Feb 29, 2024

Damn, good catch - sorry, that's a bug then! We'll fix this as soon as possible.

@srujun
Copy link
Author

srujun commented Feb 29, 2024

Thanks for fixing this! Will the changes in #10861 be included in a release that we can use directly?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 2 Feb 29, 2024
@AbhiPrasad
Copy link
Member

@srujun yes! Please see #10865

@srujun
Copy link
Author

srujun commented Mar 1, 2024

I don't think #10865 fixed the issue unfortunately. I updated all my sentry packages to 7.104.0, deleted my node_modules, and reran yarn install but it still gives me the same error.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 2 Mar 1, 2024
@mydea
Copy link
Member

mydea commented Mar 1, 2024

The dependencies should be correct now - can you delete your lockfile and try again? Chances are there is some leftover old version in there somewhere...?

@getsantry
Copy link

getsantry bot commented Mar 26, 2024

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added the Stale label Mar 26, 2024
@getsantry getsantry bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 3, 2024
@mateomisas
Copy link

I'm having the same issue, currently working with:

 "@sentry/node": "^7.116.0",
 "@sentry/profiling-node": "^1.3.3",

@mydea
Copy link
Member

mydea commented May 29, 2024

Starting in v8, @sentry/node and @sentry/profiling-node are released in lockstep, so you have to add them with the exact same version:

 "@sentry/node": "^8.5.0",
 "@sentry/profiling-node": "^8.5.0",

On v7, I recommend to delete your lockfile and re-install, probably there are some leftover old versions in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: node Issues related to the Sentry Node SDK Stale Type: Bug
Projects
Archived in project
Development

No branches or pull requests

4 participants