Skip to content
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

fix: Fixed issue with bluebird and when instrumentation where checking active context crashed when transaction prematurely ends #2909

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

bizob2828
Copy link
Member

Description

A customer reported a regression(#2908) when upgrading to 12.11.0+. This surfaced when we removed the transaction from segment and there was some naive checking in both promise-shim and when instrumentation.
This PR adds some defensive code to handle when a transaction prematurely ends and instrumentation for when and bluebird attempt to check if it has to propagate the segment/transaction through the promise methods.
I also added some tests to assert that this behavior has been fixed. If you run the tests without the code, change it crashes with same reported error.

Related Issues

Closes #2908

…cking active context crashed when transaction prematurely ends
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.82%. Comparing base (559dc98) to head (4c65c3c).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
lib/shim/promise-shim.js 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2909      +/-   ##
==========================================
- Coverage   90.26%   88.82%   -1.44%     
==========================================
  Files         289      299      +10     
  Lines       45807    46791     +984     
==========================================
+ Hits        41347    41563     +216     
- Misses       4460     5228     +768     
Flag Coverage Δ
integration-tests-cjs-18.x ?
integration-tests-cjs-20.x ?
integration-tests-cjs-22.x 73.15% <0.00%> (ø)
integration-tests-esm-18.x 49.81% <0.00%> (?)
integration-tests-esm-20.x 49.82% <0.00%> (ø)
integration-tests-esm-22.x 49.87% <0.00%> (ø)
unit-tests-18.x ?
unit-tests-20.x ?
unit-tests-22.x ?
versioned-tests-18.x 79.23% <85.71%> (?)
versioned-tests-20.x 79.23% <85.71%> (?)
versioned-tests-22.x 79.24% <85.71%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bizob2828 bizob2828 merged commit 4a30d5c into newrelic:main Jan 29, 2025
27 of 29 checks passed
@bizob2828 bizob2828 deleted the defensive-promise-shim branch January 29, 2025 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done: Issues recently completed
Development

Successfully merging this pull request may close these issues.

TypeError: Cannot read properties of null (reading 'isActive') after upgrading to v12.11.2
2 participants