Issue with Websockets - Cannot redefine property: __NR_segment
See original GitHub issueHi - I’m unable to connect to a puppeteer service on Node (version 12.16.1) while the node-newrelic agent (version 6.5.0) is active - the request fails with the following stacktrace:
TypeError: Cannot redefine property: __NR_segment at Function.defineProperty (<anonymous>) at instrumentRequest (/Volumes/Development/xxxx/node_modules/newrelic/lib/instrumentation/core/http-outbound.js:129:12) at wrapped (/Volumes/Development/xxxx/node_modules/newrelic/lib/transaction/tracer/index.js:188:22) at Tracer.addSegment (/Volumes/Development/xxxx/node_modules/newrelic/lib/transaction/tracer/index.js:83:48) at instrumentOutbound (/Volumes/Development/xxxx/node_modules/newrelic/lib/instrumentation/core/http-outbound.js:75:23) at wrappedRequest (/Volumes/Development/xxxx/node_modules/newrelic/lib/instrumentation/core/http.js:476:12) at initAsClient (/Volumes/Development/xxxx/node_modules/puppeteer/node_modules/ws/lib/websocket.js:555:31) at new WebSocket (/Volumes/Development/xxxx/node_modules/puppeteer/node_modules/ws/lib/websocket.js:70:7)
Appreciate any ideas or guidance!
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
@astormnewrelic of course! prerender.zip
Removing some code to create the sample, I’ve found out that the issue happens when two code instrumentations are enabled. We are using Google Cloud Trace besides New Relic, and when I enable Google Cloud Trace and New Relic at the same time, the error starts showing.
To run the sample you need a Google Chrome Headless running locally. To do this, use docker:
docker run -p 9222:9222 --rm --name headless-shell --shm-size 2G chromedp/headless-shell:69.0.3481.1
Then install the sample dependencies:
npm install
Start the app:
GOOGLE_CLOUD_TRACE_ENABLED=true NEW_RELIC_ENABLED=true REMOTE_CHROME_ENABLED=true NEW_RELIC_LICENSE_KEY=<the license key> npm start
To reproduce the error, you need to make a request to the server, like this:
curl "http://localhost:3000/render?url=https://www.google.com/"
The horrible fix is in server.js, and it’s commented out.
Thanks!
If this is still an issue, we recommend reaching out to New Relic support.