@sentry/node
Advanced tools
Comparing version 7.108.0 to 7.109.0
@@ -21,2 +21,20 @@ var { | ||
function globalWithScopeFetchFn() { | ||
return utils.GLOBAL_OBJ; | ||
} | ||
/** Fetches merged scope data */ | ||
function getScopeData() { | ||
const scope = core.getGlobalScope().getScopeData(); | ||
core.mergeScopeData(scope, core.getIsolationScope().getScopeData()); | ||
core.mergeScopeData(scope, core.getCurrentScope().getScopeData()); | ||
// We remove attachments because they likely won't serialize well as json | ||
scope.attachments = []; | ||
// We can't serialize event processor functions | ||
scope.eventProcessors = []; | ||
return scope; | ||
} | ||
/** | ||
@@ -48,5 +66,14 @@ * We need to use dynamicRequire because worker_threads is not available in node < v12 and webpack error will when | ||
const _anrIntegration = ((options = {}) => { | ||
if (nodeVersion.NODE_VERSION.major < 16 || (nodeVersion.NODE_VERSION.major === 16 && nodeVersion.NODE_VERSION.minor < 17)) { | ||
throw new Error('ANR detection requires Node 16.17.0 or later'); | ||
} | ||
let worker; | ||
let client; | ||
// Hookup the scope fetch function to the global object so that it can be called from the worker thread via the | ||
// debugger when it pauses | ||
const gbl = globalWithScopeFetchFn(); | ||
gbl.__SENTRY_GET_SCOPES__ = getScopeData; | ||
return { | ||
@@ -75,6 +102,2 @@ name: INTEGRATION_NAME, | ||
setup(initClient) { | ||
if (nodeVersion.NODE_VERSION.major < 16 || (nodeVersion.NODE_VERSION.major === 16 && nodeVersion.NODE_VERSION.minor < 17)) { | ||
throw new Error('ANR detection requires Node 16.17.0 or later'); | ||
} | ||
client = initClient; | ||
@@ -81,0 +104,0 @@ |
@@ -10,6 +10,2 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
function isBoomObject(response) { | ||
return response && (response ).isBoom !== undefined; | ||
} | ||
function isErrorEvent(event) { | ||
@@ -42,5 +38,3 @@ return event && (event ).error !== undefined; | ||
if (request.response && isBoomObject(request.response)) { | ||
sendErrorToSentry(request.response); | ||
} else if (isErrorEvent(event)) { | ||
if (isErrorEvent(event)) { | ||
sendErrorToSentry(event.error); | ||
@@ -47,0 +41,0 @@ } |
@@ -280,10 +280,12 @@ var { | ||
const frameCount = _optionalChain([exception, 'access', _32 => _32.stacktrace, 'optionalAccess', _33 => _33.frames, 'optionalAccess', _34 => _34.length]) || 0; | ||
// Filter out frames where the function name is `new Promise` since these are in the error.stack frames | ||
// but do not appear in the debugger call frames | ||
const frames = (_optionalChain([exception, 'access', _32 => _32.stacktrace, 'optionalAccess', _33 => _33.frames]) || []).filter(frame => frame.function !== 'new Promise'); | ||
for (let i = 0; i < frameCount; i++) { | ||
for (let i = 0; i < frames.length; i++) { | ||
// Sentry frames are in reverse order | ||
const frameIndex = frameCount - i - 1; | ||
const frameIndex = frames.length - i - 1; | ||
// Drop out if we run out of frames to match up | ||
if (!_optionalChain([exception, 'optionalAccess', _35 => _35.stacktrace, 'optionalAccess', _36 => _36.frames, 'optionalAccess', _37 => _37[frameIndex]]) || !cachedFrame[i]) { | ||
if (!frames[frameIndex] || !cachedFrame[i]) { | ||
break; | ||
@@ -296,5 +298,5 @@ } | ||
// We're not interested in frames that are not in_app because the vars are not relevant | ||
exception.stacktrace.frames[frameIndex].in_app === false || | ||
frames[frameIndex].in_app === false || | ||
// The function names need to match | ||
!common.functionNamesMatch(exception.stacktrace.frames[frameIndex].function, cachedFrame[i].function) | ||
!common.functionNamesMatch(frames[frameIndex].function, cachedFrame[i].function) | ||
) { | ||
@@ -304,3 +306,3 @@ continue; | ||
exception.stacktrace.frames[frameIndex].vars = cachedFrame[i].vars; | ||
frames[frameIndex].vars = cachedFrame[i].vars; | ||
} | ||
@@ -310,3 +312,3 @@ } | ||
function addLocalVariablesToEvent(event) { | ||
for (const exception of _optionalChain([event, 'optionalAccess', _38 => _38.exception, 'optionalAccess', _39 => _39.values]) || []) { | ||
for (const exception of _optionalChain([event, 'optionalAccess', _34 => _34.exception, 'optionalAccess', _35 => _35.values]) || []) { | ||
addLocalVariablesToException(exception); | ||
@@ -322,5 +324,5 @@ } | ||
const client = core.getClient(); | ||
const clientOptions = _optionalChain([client, 'optionalAccess', _40 => _40.getOptions, 'call', _41 => _41()]); | ||
const clientOptions = _optionalChain([client, 'optionalAccess', _36 => _36.getOptions, 'call', _37 => _37()]); | ||
if (session && _optionalChain([clientOptions, 'optionalAccess', _42 => _42.includeLocalVariables])) { | ||
if (session && _optionalChain([clientOptions, 'optionalAccess', _38 => _38.includeLocalVariables])) { | ||
// Only setup this integration if the Node version is >= v18 | ||
@@ -350,3 +352,3 @@ // https://github.com/getsentry/sentry-javascript/issues/7697 | ||
utils.logger.log('Local variables rate-limit lifted.'); | ||
_optionalChain([session, 'optionalAccess', _43 => _43.setPauseOnExceptions, 'call', _44 => _44(true)]); | ||
_optionalChain([session, 'optionalAccess', _39 => _39.setPauseOnExceptions, 'call', _40 => _40(true)]); | ||
}, | ||
@@ -357,3 +359,3 @@ seconds => { | ||
); | ||
_optionalChain([session, 'optionalAccess', _45 => _45.setPauseOnExceptions, 'call', _46 => _46(false)]); | ||
_optionalChain([session, 'optionalAccess', _41 => _41.setPauseOnExceptions, 'call', _42 => _42(false)]); | ||
}, | ||
@@ -360,0 +362,0 @@ ); |
import { _optionalChain, _optionalChainDelete } from '@sentry/utils'; | ||
import { URL } from 'url'; | ||
import { defineIntegration, convertIntegrationFnToClass, getCurrentScope } from '@sentry/core'; | ||
import { logger, dynamicRequire } from '@sentry/utils'; | ||
import { defineIntegration, convertIntegrationFnToClass, getGlobalScope, mergeScopeData, getIsolationScope, getCurrentScope } from '@sentry/core'; | ||
import { logger, GLOBAL_OBJ, dynamicRequire } from '@sentry/utils'; | ||
import { NODE_VERSION } from '../../nodeVersion.js'; | ||
@@ -15,2 +15,20 @@ import { base64WorkerScript } from './worker-script.js'; | ||
function globalWithScopeFetchFn() { | ||
return GLOBAL_OBJ; | ||
} | ||
/** Fetches merged scope data */ | ||
function getScopeData() { | ||
const scope = getGlobalScope().getScopeData(); | ||
mergeScopeData(scope, getIsolationScope().getScopeData()); | ||
mergeScopeData(scope, getCurrentScope().getScopeData()); | ||
// We remove attachments because they likely won't serialize well as json | ||
scope.attachments = []; | ||
// We can't serialize event processor functions | ||
scope.eventProcessors = []; | ||
return scope; | ||
} | ||
/** | ||
@@ -42,5 +60,14 @@ * We need to use dynamicRequire because worker_threads is not available in node < v12 and webpack error will when | ||
const _anrIntegration = ((options = {}) => { | ||
if (NODE_VERSION.major < 16 || (NODE_VERSION.major === 16 && NODE_VERSION.minor < 17)) { | ||
throw new Error('ANR detection requires Node 16.17.0 or later'); | ||
} | ||
let worker; | ||
let client; | ||
// Hookup the scope fetch function to the global object so that it can be called from the worker thread via the | ||
// debugger when it pauses | ||
const gbl = globalWithScopeFetchFn(); | ||
gbl.__SENTRY_GET_SCOPES__ = getScopeData; | ||
return { | ||
@@ -69,6 +96,2 @@ name: INTEGRATION_NAME, | ||
setup(initClient) { | ||
if (NODE_VERSION.major < 16 || (NODE_VERSION.major === 16 && NODE_VERSION.minor < 17)) { | ||
throw new Error('ANR detection requires Node 16.17.0 or later'); | ||
} | ||
client = initClient; | ||
@@ -75,0 +98,0 @@ |
@@ -8,6 +8,2 @@ import { defineIntegration, convertIntegrationFnToClass, SDK_VERSION, getActiveTransaction, captureException, continueTrace, startTransaction, getCurrentScope, spanToTraceHeader, getDynamicSamplingContextFromSpan, setHttpStatus } from '@sentry/core'; | ||
function isBoomObject(response) { | ||
return response && (response ).isBoom !== undefined; | ||
} | ||
function isErrorEvent(event) { | ||
@@ -40,5 +36,3 @@ return event && (event ).error !== undefined; | ||
if (request.response && isBoomObject(request.response)) { | ||
sendErrorToSentry(request.response); | ||
} else if (isErrorEvent(event)) { | ||
if (isErrorEvent(event)) { | ||
sendErrorToSentry(event.error); | ||
@@ -45,0 +39,0 @@ } |
@@ -275,10 +275,12 @@ import { _optionalChain } from '@sentry/utils'; | ||
const frameCount = _optionalChain([exception, 'access', _32 => _32.stacktrace, 'optionalAccess', _33 => _33.frames, 'optionalAccess', _34 => _34.length]) || 0; | ||
// Filter out frames where the function name is `new Promise` since these are in the error.stack frames | ||
// but do not appear in the debugger call frames | ||
const frames = (_optionalChain([exception, 'access', _32 => _32.stacktrace, 'optionalAccess', _33 => _33.frames]) || []).filter(frame => frame.function !== 'new Promise'); | ||
for (let i = 0; i < frameCount; i++) { | ||
for (let i = 0; i < frames.length; i++) { | ||
// Sentry frames are in reverse order | ||
const frameIndex = frameCount - i - 1; | ||
const frameIndex = frames.length - i - 1; | ||
// Drop out if we run out of frames to match up | ||
if (!_optionalChain([exception, 'optionalAccess', _35 => _35.stacktrace, 'optionalAccess', _36 => _36.frames, 'optionalAccess', _37 => _37[frameIndex]]) || !cachedFrame[i]) { | ||
if (!frames[frameIndex] || !cachedFrame[i]) { | ||
break; | ||
@@ -291,5 +293,5 @@ } | ||
// We're not interested in frames that are not in_app because the vars are not relevant | ||
exception.stacktrace.frames[frameIndex].in_app === false || | ||
frames[frameIndex].in_app === false || | ||
// The function names need to match | ||
!functionNamesMatch(exception.stacktrace.frames[frameIndex].function, cachedFrame[i].function) | ||
!functionNamesMatch(frames[frameIndex].function, cachedFrame[i].function) | ||
) { | ||
@@ -299,3 +301,3 @@ continue; | ||
exception.stacktrace.frames[frameIndex].vars = cachedFrame[i].vars; | ||
frames[frameIndex].vars = cachedFrame[i].vars; | ||
} | ||
@@ -305,3 +307,3 @@ } | ||
function addLocalVariablesToEvent(event) { | ||
for (const exception of _optionalChain([event, 'optionalAccess', _38 => _38.exception, 'optionalAccess', _39 => _39.values]) || []) { | ||
for (const exception of _optionalChain([event, 'optionalAccess', _34 => _34.exception, 'optionalAccess', _35 => _35.values]) || []) { | ||
addLocalVariablesToException(exception); | ||
@@ -317,5 +319,5 @@ } | ||
const client = getClient(); | ||
const clientOptions = _optionalChain([client, 'optionalAccess', _40 => _40.getOptions, 'call', _41 => _41()]); | ||
const clientOptions = _optionalChain([client, 'optionalAccess', _36 => _36.getOptions, 'call', _37 => _37()]); | ||
if (session && _optionalChain([clientOptions, 'optionalAccess', _42 => _42.includeLocalVariables])) { | ||
if (session && _optionalChain([clientOptions, 'optionalAccess', _38 => _38.includeLocalVariables])) { | ||
// Only setup this integration if the Node version is >= v18 | ||
@@ -345,3 +347,3 @@ // https://github.com/getsentry/sentry-javascript/issues/7697 | ||
logger.log('Local variables rate-limit lifted.'); | ||
_optionalChain([session, 'optionalAccess', _43 => _43.setPauseOnExceptions, 'call', _44 => _44(true)]); | ||
_optionalChain([session, 'optionalAccess', _39 => _39.setPauseOnExceptions, 'call', _40 => _40(true)]); | ||
}, | ||
@@ -352,3 +354,3 @@ seconds => { | ||
); | ||
_optionalChain([session, 'optionalAccess', _45 => _45.setPauseOnExceptions, 'call', _46 => _46(false)]); | ||
_optionalChain([session, 'optionalAccess', _41 => _41.setPauseOnExceptions, 'call', _42 => _42(false)]); | ||
}, | ||
@@ -355,0 +357,0 @@ ); |
{ | ||
"name": "@sentry/node", | ||
"version": "7.108.0", | ||
"version": "7.109.0", | ||
"description": "Official Sentry SDK for Node.js", | ||
@@ -32,6 +32,6 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry-internal/tracing": "7.108.0", | ||
"@sentry/core": "7.108.0", | ||
"@sentry/types": "7.108.0", | ||
"@sentry/utils": "7.108.0" | ||
"@sentry-internal/tracing": "7.109.0", | ||
"@sentry/core": "7.109.0", | ||
"@sentry/types": "7.109.0", | ||
"@sentry/utils": "7.109.0" | ||
}, | ||
@@ -38,0 +38,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2107801
13782
+ Added@sentry-internal/tracing@7.109.0(transitive)
+ Added@sentry/core@7.109.0(transitive)
+ Added@sentry/types@7.109.0(transitive)
+ Added@sentry/utils@7.109.0(transitive)
- Removed@sentry-internal/tracing@7.108.0(transitive)
- Removed@sentry/core@7.108.0(transitive)
- Removed@sentry/types@7.108.0(transitive)
- Removed@sentry/utils@7.108.0(transitive)
Updated@sentry/core@7.109.0
Updated@sentry/types@7.109.0
Updated@sentry/utils@7.109.0