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.

Type 'Tracing' is not assignable to type 'Integration'.

See original GitHub issue

Package + Version

  • [5.17.0] @sentry/browser
  • [5.17.0] @sentry/apm
  • [3.9.3] typescript

Version:

5.17.0

Description

Describe your issue in detail, ideally, you have a reproducible demo that you can show. Followed Javascript setup from https://docs.sentry.io/performance/distributed-tracing/?_ga=2.119653007.60898342.1591903247-665646710.1589239592#javascript

import * as Sentry from ‘@sentry/browser’ import { Integrations as ApmIntegrations } from ‘@sentry/apm’;

Sentry.init({ dsn: <SENTRY.DSN>, integrations: [new ApmIntegrations.Tracing()], tracesSampleRate: 0.25 })

will throw a Typescript error Type ‘Tracing’ is not assignable to type ‘Integration’. Types of property ‘setupOnce’ are incompatible. Type ‘(addGlobalEventProcessor: (callback: import(“node_modules/@sentry/apm/node_modules/@sentry/types/dist/eventprocessor”).EventProcessor) => void, getCurrentHub: () => import("/node_modules/@sentry/apm/node_modules/@sentry/hub/dist…’ is not assignable to type ‘(addGlobalEventProcessor: (callback: import(“/node_modules/@sentry/types/dist/eventprocessor”).EventProcessor) => void, getCurrentHub: () => import(“/node_modules/@sentry/types/dist/hub”).Hub) => void’. Types of parameters ‘addGlobalEventProcessor’ and ‘addGlobalEventProcessor’ are incompatible. Types of parameters ‘callback’ and ‘callback’ are incompatible. Type ‘import(“/node_modules/@sentry/apm/node_modules/@sentry/types/dist/eventprocessor”).EventProcessor’ is not assignable to type ‘import(“/node_modules/@sentry/types/dist/eventprocessor”).EventProcessor’. Types of parameters ‘event’ and ‘event’ are incompatible. Type ‘import(“/node_modules/@sentry/types/dist/event”).Event’ is not assignable to type ‘import(“/node_modules/@sentry/apm/node_modules/@sentry/types/dist/event”).Event’. Types of property ‘spans’ are incompatible. Type ‘import(“/node_modules/@sentry/types/dist/span”).Span[]’ is not assignable to type ‘import(“/node_modules/@sentry/apm/node_modules/@sentry/types/dist/span”).Span[]’. Type ‘Span’ is missing the following properties from type ‘Span’: spanId, traceId, startTimestamp, tags, and 2 more.ts(2322)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

16reactions
jamsinclaircommented, Dec 23, 2020

Encountered this just now, upgrading all Sentry modules to their latest versions resolved it. Noticed the type error when @sentry/react was at v5.29.0 and @sentry/tracing was at v5.29.2.

Might help others 🙂

5reactions
fokusferitcommented, Dec 3, 2020

I have to admit I hit this error too. But changing the imports isn’t an option here. Might be an issue with Typescript itself.

What helped is casting it:

import { Integration } from '@sentry/types';
....
      integrations: [new BrowserTracing() as Integration],
´´´ 

Sharing this for others, who might end up here searching 😄 
Read more comments on GitHub >

github_iconTop Results From Across the Web

@sentry/tracing - npm
Start using @sentry/tracing in your project by running `npm i ... TypeScript icon, indicating that this package has built-in type ...
Read more >
BrowserTracing | Sentry JavaScript SDKs - v5.21.1
The Browser Tracing integration automatically instruments browser pageload/navigation actions as transactions, and captures requests, metrics and errors as ...
Read more >
@sentry/browser | Yarn - Package Manager
... fix(tracing): Baggage parsing fails when input is not of type string (#5276) ... integration where event would not be send in case...
Read more >
Troubleshooting for JavaScript - Sentry Documentation
The shape of the data may not exactly match the description. ... you are using too generic a configuration for our Tracing Integration...
Read more >
How to Add Sentry to Your Node.js Project with TypeScript
These logs provide information such as a trace stack, breadcrumbs, ... user that triggered the error, the error message, and the error type....
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