-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(node): Fix local variables capturing for out-of-app frames #17545
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
Open
JealousGx
wants to merge
11
commits into
getsentry:develop
Choose a base branch
from
JealousGx:fix/local-variables-12588
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+246
−108
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d92b0a0
fix(node-core): Fix local variables capturing for out-of-app frames (…
JealousGx 7ca795c
fix(local-variables): Clean up function assignment and fix syntax in …
JealousGx 5323928
fix(local-variables): Refine condition for skipping out-of-app frames…
JealousGx 7fb4542
fix(node-core): Fix race condition in local variables integration
JealousGx 662ab6d
Merge branch 'develop' into fix/local-variables-12588
JealousGx 367ef5c
test(local-variables): Add integration tests for local variables in o…
JealousGx 76893c5
refactor(local-variables): Remove test helper methods and related tests
JealousGx 6ff90dc
refactor(local-variables): Remove local variables async integration t…
JealousGx c81dc55
Merge branch 'develop' into fix/local-variables-12588
JealousGx d2a40cf
fix(logging-transport): Correct import path for loggingTransport to r…
JealousGx 651d3f3
Merge branch 'develop' into fix/local-variables-12588
JealousGx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
...-integration-tests/suites/public-api/LocalVariables/local-variables-out-of-app-default.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* eslint-disable no-unused-vars */ | ||
|
||
const Sentry = require('@sentry/node'); | ||
const { loggingTransport } = require('@sentry-internal/node-integration-tests'); | ||
|
||
// make sure to create the following file with the following content: | ||
// function out_of_app_function() { | ||
// const outOfAppVar = 'out of app value'; | ||
// throw new Error('out-of-app error'); | ||
// } | ||
|
||
// module.exports = { out_of_app_function }; | ||
|
||
const { out_of_app_function } = require('./node_modules/test-module/out-of-app-function.js'); | ||
|
||
function in_app_function() { | ||
const inAppVar = 'in app value'; | ||
out_of_app_function(); | ||
} | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/1337', | ||
transport: loggingTransport, | ||
includeLocalVariables: true, | ||
// either set each frame's in_app flag manually or import the `out_of_app_function` from a node_module directory | ||
// beforeSend: (event) => { | ||
// event.exception?.values?.[0]?.stacktrace?.frames?.forEach(frame => { | ||
// if (frame.function === 'out_of_app_function') { | ||
// frame.in_app = false; | ||
// } | ||
// }); | ||
// return event; | ||
// }, | ||
}); | ||
|
||
setTimeout(async () => { | ||
try { | ||
in_app_function(); | ||
} catch (e) { | ||
Sentry.captureException(e); | ||
await Sentry.flush(); | ||
|
||
return null; | ||
} | ||
}, 1000); |
41 changes: 41 additions & 0 deletions
41
...ges/node-integration-tests/suites/public-api/LocalVariables/local-variables-out-of-app.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* eslint-disable no-unused-vars */ | ||
|
||
const Sentry = require('@sentry/node'); | ||
const { loggingTransport } = require('@sentry-internal/node-integration-tests'); | ||
|
||
const { out_of_app_function } = require('./node_modules/test-module/out-of-app-function.js'); | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/1337', | ||
transport: loggingTransport, | ||
includeLocalVariables: true, | ||
integrations: [ | ||
Sentry.localVariablesIntegration({ | ||
includeOutOfAppFrames: true, | ||
}), | ||
], | ||
// either set each frame's in_app flag manually or import the `out_of_app_function` from a node_module directory | ||
// beforeSend: (event) => { | ||
// event.exception?.values?.[0]?.stacktrace?.frames?.forEach(frame => { | ||
// if (frame.function === 'out_of_app_function') { | ||
// frame.in_app = false; | ||
// } | ||
// }); | ||
// return event; | ||
// }, | ||
}); | ||
|
||
function in_app_function() { | ||
const inAppVar = 'in app value'; | ||
out_of_app_function(); | ||
} | ||
|
||
setTimeout(async () => { | ||
try { | ||
in_app_function(); | ||
} catch (e) { | ||
Sentry.captureException(e); | ||
await Sentry.flush(); | ||
return null; | ||
} | ||
}, 1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Missing Dependency in Test Setup
The new local variables test files depend on
./node_modules/test-module/out-of-app-function.js
. This module isn't provided in the commit or created by the test setup, which will lead to a "module not found" error at runtime. This indicates an incomplete test setup, as also suggested by the manual creation comments.Additional Locations (1)
dev-packages/node-integration-tests/suites/public-api/LocalVariables/local-variables-out-of-app-default.js#L14-L15