Skip to content

Fix http monkeypatching for Node 18.15 introduced in v7.42.0 #7425

@dotansimha

Description

@dotansimha

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using? If you use the CDN bundles, please specify the exact bundle (e.g. bundle.tracing.min.js) in your SDK setup.

@sentry/node

SDK Version

7.42.0

Framework Version

Node 18.15

Link to Sentry event

No response

SDK Setup

Nothing too fancy. Just a regular setup with defaults:

    Sentry.init({
      serverName: 'webhooks',
      enabled: !!env.sentry,
      environment: env.environment,
      dsn: env.sentry.dsn,
      release: env.release,
    });

Steps to Reproduce

Since upgraded to v7.42.0 along with Node 18.15, I get this error when my server starts:

TypeError: Cannot assign to read only property 'get' of object '[object Module]'
    at fill (file:///usr/src/app/index.js:169657:16)
    at Http2.setupOnce (file:///usr/src/app/index.js:174266:5)
    at setupIntegration (file:///usr/src/app/index.js:172908:17)
    at file:///usr/src/app/index.js:172899:7
    at Array.forEach (<anonymous>)
    at setupIntegrations (file:///usr/src/app/index.js:172897:16)
    at NodeClient2.setupIntegrations (file:///usr/src/app/index.js:173180:28)
    at Hub2.bindClient (file:///usr/src/app/index.js:171810:14)
    at initAndBind (file:///usr/src/app/index.js:173445:7)
    at init (file:///usr/src/app/index.js:175864:3)
    at main (file:///usr/src/app/index.js:210652:5)
    at file:///usr/src/app/index.js:210766:1
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

And this line is found in:
https://github.com/getsentry/sentry-javascript/blob/develop/packages/node/src/integrations/http.ts#L105

It seems like a recent PR was touching these code areas? #7377

Reverting back to 7.41.0 seems to work perfectly fine.

Expected Result

Actual Result

Metadata

Metadata

Assignees

Labels

Package: nodeIssues related to the Sentry Node SDK

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions