Comments (4)
To make it worse, the re-exported withScope in @sentry/node is using this different Scope, so even an import line like import { Scope, addRequestDataToEvent, captureException, withScope } from '@sentry/node';
is incompatible
Nor does this work
import { Scope, withScope } from '@sentry/core';
import { addRequestDataToEvent, captureException } from '@sentry/node';
from sentry-javascript.
Hey,
could you share the actual code that is triggering this problem for you? e.g.
import {Scope} from '@sentry/node';
function myFunction(scope: Scope): void {
xxx(scope);
}
It should be the case that you can pass the scope from @sentry/node
everywhere - this is the actual scope class, while in all places that accept a scope we should be using the scope type. but it may be the case that we missed some place there 🤔
from sentry-javascript.
Sorry, I didn't write properly in the issue description, but it's exactly what @roderik is mentioning as well.
import { type Scope, withScope } from '@sentry/node';
withScope((scope: Scope) => {});
// ^
// Argument of type
// 'import(".../node_modules/@sentry/types/types/scope").Scope'
// is not assignable to parameter of type
// 'import(".../node_modules/@sentry/core/types/scope").Scope'.
@sentry/node
exports the Scope
class from @sentry/core
.
@sentry/node
also exports withScope
from @sentry/core
. This withScope
method has a callback
argument of type Scope
, an interface that comes from @sentry/types
.
This was not the case in v7, where the Scope
class was also used by the callback of withScope
.
The class and the interface are not compatible with each other.
from sentry-javascript.
Ah, I see now.
Yeah, this is a bit annoying/tricky. What you can do for now is install @sentry/types
and import all the types you use in your app from there:
import { withScope } from '@sentry/node';
import type { Scope } from '@sentry/types';
withScope(scope: Scope, () => {});
(that, or let the type be inferred, which should be correct as well).
I have opened a PR to fix this behavior in the next version: #12067
There, it should work again to do import type {Scope} from '@sentry/node'
and get the expected behavior!
from sentry-javascript.
Related Issues (20)
- Add solidstart to release registry
- Add release registry target entry for solidstart to craft.yml
- Add solidstart SDK docs
- Add solidstart onboarding
- A drop in simultaneous requests per seconds with Bun when Sentry is active HOT 3
- Align `Span` interface with changes in Otel Span interface
- Could not find a declaration file for module `@sentry/profiling-node` HOT 5
- Sentry SDK sends events of type `session` twice to two different DSNs
- Add Nuxt SDK package boilerplate
- Inconsisten span origin naming
- SpyOn captureException no longer works in sentry/react 8 HOT 2
- V8 Integrations are broken HOT 9
- Code sign the Sentry lambda layer to use in code signed lambdas HOT 1
- Module not found: Can't resolve 'opentelemetry-instrumentation-fetch-node' HOT 3
- Local variables missing when exception originates in node_modules dependency HOT 4
- Renable http instrumentation test for node-express-esm-preload
- JavaScript heap out of memory HOT 3
- Feedback Modal: Missing Screenshot btn in production HOT 3
- Sentry.captureFeedback produces unviewable images in sentry.io
- Problems with `@sentry/astro` on Netfliy HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-javascript.