Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

TypeScript error with 7.64.0 version of Sentry packages #190

Closed
3 tasks done
SheaBelsky opened this issue Aug 24, 2023 · 14 comments
Closed
3 tasks done

TypeScript error with 7.64.0 version of Sentry packages #190

SheaBelsky opened this issue Aug 24, 2023 · 14 comments

Comments

@SheaBelsky
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

SDK Version

1.1.2

Link to Sentry event

No response

What environment is your node script running in?

Express + Apollo Server

How is your code deployed and bundled?

Azure App Service

Steps to Reproduce

  1. Installed latest (as of 08/23/2023) version of @sentry packages, 7.64.0
  2. Ran npm install
  3. Encounter TypeScript errors in the file with Sentry.init

Expected Result

The plugin works without type casting

Actual Result

src/utils/errors.ts:20:7 - error TS2322: Type 'ProfilingIntegration' is not assignable to type 'Integration'.
  Types of property 'setupOnce' are incompatible.
    Type '(addGlobalEventProcessor: (callback: import("/node_modules/@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/integrations/node_modules/@sentry/types/types/eventprocessor").EventProcessor) => void, getCurrentHub: () => import("/node_modules/@sentry/integrations/node_modules/@sentry...'.
      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/integrations/node_modules/@sentry/types/types/eventprocessor").EventProcessor'.
            Types of parameters 'event' and 'event' are incompatible.
              Type 'import("/node_modules/@sentry/integrations/node_modules/@sentry/types/types/event").Event' is not assignable to type 'import("/node_modules/@sentry/types/types/event").Event'.
                Types of property 'spans' are incompatible.
                  Type 'import("/node_modules/@sentry/integrations/node_modules/@sentry/types/types/span").Span[] | undefined' is not assignable to type 'import("/node_modules/@sentry/types/types/span").Span[] | undefined'.
                    Type 'import("/node_modules/@sentry/integrations/node_modules/@sentry/types/types/span").Span[]' is not assignable to type 'import("/node_modules/@sentry/types/types/span").Span[]'.
                      Type 'import("/node_modules/@sentry/integrations/node_modules/@sentry/types/types/span").Span' is not assignable to type 'import("/node_modules/@sentry/types/types/span").Span'.
                        Types of property 'transaction' are incompatible.
                          Type 'import("/node_modules/@sentry/integrations/node_modules/@sentry/types/types/transaction").Transaction | undefined' is not assignable to type 'import("/node_modules/@sentry/types/types/transaction").Transaction | undefined'.
                            Type 'import("/node_modules/@sentry/integrations/node_modules/@sentry/types/types/transaction").Transaction' is not assignable to type 'import("/node_modules/@sentry/types/types/transaction").Transaction'.
                              The types returned by 'setTag(...)' are incompatible between these types.
                                Type 'Span' is missing the following properties from type 'Transaction': metadata, setContext, setMeasurement, setMetadata, getDynamicSamplingContext

20       new ProfilingIntegration(),

Code snippet:

import { ExtraErrorData } from "@sentry/integrations";
import { ProfilingIntegration } from "@sentry/profiling-node";
import { SENTRY_DSN } from "../models/sentry/data";
import * as Sentry from "@sentry/node";

Sentry.init({
    dsn: SENTRY_DSN,
    integrations: [
      new ExtraErrorData({
        depth: 3
      }),
      new ProfilingIntegration(),
      new Sentry.Integrations.Prisma({ client: prisma })
    ],
    maxValueLength: 1000,
    profilesSampleRate: 0,
    tracesSampleRate: 0.5
});
@n0th1ng-else
Copy link

Same error here

@JonasBa
Copy link
Member

JonasBa commented Aug 28, 2023

Sorry for the delay - I released version 1.1.3 of the profiling package which should fix this error. Please reopen if that is not the case and I'll take a look asap

@g-popovic
Copy link

I still get this error on v1.2.6. @sentry/node is v7.86.0, node v18.17.0

@lukevers
Copy link

Same here, but slightly different error:

dependencies:
+ @sentry/profiling-node 1.2.6
+ @sentry/serverless 7.86.0
$ node -v
v18.18.2
Type 'ProfilingIntegration' is not assignable to type 'Integration'.
  Types of property 'setupOnce' are incompatible.
    Types of parameters 'getCurrentHub' and 'getCurrentHub' are incompatible.
      Call signature return types 'Hub' and 'Hub' are incompatible.
        The types of 'bindClient' are incompatible between these types.
          Type '(client?: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/options...' is not assignable to type '(client?: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/options...'.
            Types of parameters 'client' and 'client' are incompatible.
              Type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/options").ClientO...' is not assignable to type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/options").ClientO...'.
                Type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/options").ClientO...' is not assignable to type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/options").ClientO...'.
                  The types of 'getOptions().integrations' are incompatible between these types.
                    Type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/integration").Integration[]' is not assignable to type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/integration").Integration[]'.
                      Type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/integration").Integration' is not assignable to type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/integration").Integration'.
                        Types of property 'preprocessEvent' are incompatible.
                          Type '((event: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/event").Event, hint: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/eve...' is not assignable to type '((event: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/event").Event, hint: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/eve...'.
                            Type '(event: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/event").Event, hint: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/even...' is not assignable to type '(event: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/event").Event, hint: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/even...'.
                              Types of parameters 'client' and 'client' are incompatible.
                                Type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/options").ClientO...' is not assignable to type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/options").ClientO...'.
                                  Types of property 'on' are incompatible.
                                    Type '{ (hook: "startTransaction", callback: (transaction: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/transaction").Transaction) => void): void; (hook: "finishTransaction", callback: (transaction: import("/Users/lukevers/Cod...' is not assignable to type '{ (hook: "startTransaction", callback: (transaction: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/transaction").Transaction) => void): void; (hook: "finishTransaction", callback: (transaction: import("/Users/lukevers/Cod...'.
                                      Type '{ (hook: "startTransaction", callback: (transaction: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/transaction").Transaction) => void): void; (hook: "finishTransaction", callback: (transaction: import("/Users/lukevers/Cod...' is not assignable to type '{ (hook: "startTransaction", callback: (transaction: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/transaction").Transaction) => void): void; (hook: "finishTransaction", callback: (transaction: import("/Users/lukevers/Cod...'.
                                        Types of parameters 'hook' and 'hook' are incompatible.
                                          Type '"beforeEnvelope"' is not assignable to type '"startTransaction"'.ts(2322)

@JonasBa
Copy link
Member

JonasBa commented Dec 12, 2023

@lukevers @g-popovic we just released version 1.3.0 which should fix these issues. Please upgrade and let me know if you still see any issues

@lukevers
Copy link

@JonasBa I am still having the same issue, but I just realized maybe the problem is me and not this -- I'm using:

import Sentry from '@sentry/serverless';
import { ProfilingIntegration } from '@sentry/profiling-node';

  Sentry.AWSLambda.init({
...

Perhaps I don't actually need to add the profiling integration for the serverless init? I haven't tried it yet, but don't see any reference to adding this one here https://github.com/getsentry/sentry-javascript/tree/master/packages/serverless

@PhilHannent
Copy link

I just upgraded to:

  • @sentry/node: 7.86.0
  • @sentry/profiling-node: 1.3.1,
  • @sentry/tracing: ^7.86.0

And still got the error:

src/app.ts:117:4 - error TS2322: Type 'ProfilingIntegration' is not assignable to type 'Integration'.
Types of property 'setupOnce' are incompatible.
Type '(addGlobalEventProcessor: (callback: import("./node_modules/@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) ...'.
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 'event' and 'event' are incompatible.
Type 'import("./node_modules/@sentry/node/node_modules/@sentry/types/types/event").Event' is not assignable to type 'import("./node_modules/@sentry/types/types/event").Event'.
Types of property 'exception' are incompatible.
Type '{ values?: import("./node_modules/@sentry/node/node_modules/@sentry/types/types/exception").Exception[] | undefined; } | undefined' is not assignable to type '{ values?: import("./node_modules/@sentry/types/types/exception").Exception[] | undefined; } | undefined'.
Type '{ values?: import("./node_modules/@sentry/node/node_modules/@sentry/types/types/exception").Exception[] | undefined; }' is not assignable to type '{ values?: import("./node_modules/@sentry/types/types/exception").Exception[] | undefined; }'.
Types of property 'values' are incompatible.
Type 'import("./node_modules/@sentry/node/node_modules/@sentry/types/types/exception").Exception[] | undefined' is not assignable to type 'import("./node_modules/@sentry/types/types/exception").Exception[] | undefined'.
Type 'import("./node_modules/@sentry/node/node_modules/@sentry/types/types/exception").Exception[]' is not assignable to type 'import("./node_modules/@sentry/types/types/exception").Exception[]'.
Type 'import("./node_modules/@sentry/node/node_modules/@sentry/types/types/exception").Exception' is not assignable to type 'import("./node_modules/@sentry/types/types/exception").Exception'.
Types of property 'mechanism' are incompatible.
Type 'import("./node_modules/@sentry/node/node_modules/@sentry/types/types/mechanism").Mechanism | undefined' is not assignable to type 'import("./node_modules/@sentry/types/types/mechanism").Mechanism | undefined'.
Type 'import("./node_modules/@sentry/node/node_modules/@sentry/types/types/mechanism").Mechanism' is not assignable to type 'import("./node_modules/@sentry/types/types/mechanism").Mechanism'.
Types of property 'handled' are incompatible.
Type 'boolean | undefined' is not assignable to type 'boolean'.
Type 'undefined' is not assignable to type 'boolean'.
117 new ProfilingIntegration()

@LouAdrienFabreSMW
Copy link

+1

@emilbergs
Copy link

Same here, but slightly different error:

dependencies:
+ @sentry/profiling-node 1.2.6
+ @sentry/serverless 7.86.0
$ node -v
v18.18.2
Type 'ProfilingIntegration' is not assignable to type 'Integration'.
  Types of property 'setupOnce' are incompatible.
    Types of parameters 'getCurrentHub' and 'getCurrentHub' are incompatible.
      Call signature return types 'Hub' and 'Hub' are incompatible.
        The types of 'bindClient' are incompatible between these types.
          Type '(client?: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/options...' is not assignable to type '(client?: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/options...'.
            Types of parameters 'client' and 'client' are incompatible.
              Type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/options").ClientO...' is not assignable to type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/options").ClientO...'.
                Type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/options").ClientO...' is not assignable to type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/options").ClientO...'.
                  The types of 'getOptions().integrations' are incompatible between these types.
                    Type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/integration").Integration[]' is not assignable to type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/integration").Integration[]'.
                      Type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/integration").Integration' is not assignable to type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/integration").Integration'.
                        Types of property 'preprocessEvent' are incompatible.
                          Type '((event: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/event").Event, hint: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/eve...' is not assignable to type '((event: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/event").Event, hint: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/eve...'.
                            Type '(event: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/event").Event, hint: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/even...' is not assignable to type '(event: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/event").Event, hint: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/even...'.
                              Types of parameters 'client' and 'client' are incompatible.
                                Type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/options").ClientO...' is not assignable to type 'import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/client").Client<import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/options").ClientO...'.
                                  Types of property 'on' are incompatible.
                                    Type '{ (hook: "startTransaction", callback: (transaction: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/transaction").Transaction) => void): void; (hook: "finishTransaction", callback: (transaction: import("/Users/lukevers/Cod...' is not assignable to type '{ (hook: "startTransaction", callback: (transaction: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/transaction").Transaction) => void): void; (hook: "finishTransaction", callback: (transaction: import("/Users/lukevers/Cod...'.
                                      Type '{ (hook: "startTransaction", callback: (transaction: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.86.0/node_modules/@sentry/types/types/transaction").Transaction) => void): void; (hook: "finishTransaction", callback: (transaction: import("/Users/lukevers/Cod...' is not assignable to type '{ (hook: "startTransaction", callback: (transaction: import("/Users/lukevers/Code/typescript/github.com/arya-fyi/arya.fyi/node_modules/.pnpm/@sentry+types@7.80.1/node_modules/@sentry/types/types/transaction").Transaction) => void): void; (hook: "finishTransaction", callback: (transaction: import("/Users/lukevers/Cod...'.
                                        Types of parameters 'hook' and 'hook' are incompatible.
                                          Type '"beforeEnvelope"' is not assignable to type '"startTransaction"'.ts(2322)

Have you ensured that the version of "@sentry/types" matches the version of your Sentry/Node?

@JonasBa
Copy link
Member

JonasBa commented Dec 27, 2023

Do you mind bumping this to 1.3.2, @sentry/types is now a peer dependency and no longer used by the lib. Lmk if the issue still happens and we can take a look

@LouAdrienFabreSMW
Copy link

install 1.3.2 alone is not sufficiant. Adding @sentry/types seems to do the trick but its not listed in the sentry install instructions for the node sdk

@jjgriff93
Copy link

jjgriff93 commented Jan 18, 2024

This is still an issue when following the node docs. I also get:

Type 'ProfilingIntegration' is not assignable to type 'Integration'.
  Types of property 'setupOnce' are incompatible.

I'm using "@sentry/node": "^7.93.0" and "@sentry/profiling-node": "^1.3.5", with the configuration:

init({
  dsn: process.env.SENTRY_DSN,
  release: version.name,
  dist: version.code,
  integrations: [
    new ProfilingIntegration(),
    new Integrations.Http({ tracing: true })
  ],
   ...
});

Adding the @sentry/types package then casting got rid of the Typescript error locally:

new ProfilingIntegration() as Integration

However, when building in CI I get:

Error: ../node_modules/@sentry/profiling-node/lib/types/integration.d.ts(1,62): error TS2307: Cannot find module '@sentry/types' or its corresponding type declarations.

@jjgriff93
Copy link

Weirdly deleting my package-lock.json and re-running npm I sorted it for me, if anyone else hits the same give that a try

@FredrikZeiner
Copy link

This is still an issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants