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(node): Revert to dynamic require for http(s) monkey patching #7430

Merged
merged 1 commit into from Mar 13, 2023

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Mar 13, 2023

This PR partially reverts #7377 which caused monkey patching errors when patching the native http and https modules in the Node SDK (#7425). Similarly, also our Serverless SDK was subjected to the same problem (#7421).

The problem is that import doesn't permit monkey patching of the imported http module functions, producing this error:

TypeError: Cannot assign to read only property 'get' of object '[object Module]'

I tried using a dynamic import instead but got the same result. So it seems like we can only use require here :(

This also seems to be a known problem for the oTel folks: open-telemetry/opentelemetry-js#1946

Merging this PR means, we'll have to think of something for the SvelteKit SDK but we should nevertheless do it and cut a release to unblock everyone experiencing this error.

closes #7425
closes #7421

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.24 KB (+0.13% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 62.95 KB (+0.11% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.87 KB (+0.11% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 55.87 KB (+0.12% 🔺)
@sentry/browser - Webpack (gzipped + minified) 20.62 KB (+0.12% 🔺)
@sentry/browser - Webpack (minified) 67.39 KB (+0.1% 🔺)
@sentry/react - Webpack (gzipped + minified) 20.65 KB (+0.12% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 48.54 KB (+0.18% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 27.51 KB (+0.23% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.76 KB (+0.22% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.17 KB (+0.01% 🔺)
@sentry/replay - Webpack (gzipped + minified) 37.19 KB (0%)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 61.18 KB (+0.09% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 54.35 KB (+0.04% 🔺)

@Lms24 Lms24 requested review from mydea and AbhiPrasad March 13, 2023 10:27
@Lms24 Lms24 linked an issue Mar 13, 2023 that may be closed by this pull request
3 tasks
@Lms24 Lms24 changed the title fix(node): Revert to dynamic require call to fix monkey patching fix(node): Revert to dynamic require call to fix http(s) monkey patching Mar 13, 2023
@Lms24 Lms24 changed the title fix(node): Revert to dynamic require call to fix http(s) monkey patching fix(node): Revert to dynamic require for http(s) monkey patching Mar 13, 2023
@Lms24 Lms24 merged commit fe1231a into develop Mar 13, 2023
@Lms24 Lms24 deleted the lms/fix-node-http-import-breaking-patching branch March 13, 2023 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix http monkeypatching for Node 18.15 introduced in v7.42.0 @sentry/serverless
3 participants