question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with Websockets - Cannot redefine property: __NR_segment

See original GitHub issue

Hi - 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:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gnavalesi-naventcommented, Jun 10, 2020

@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!

0reactions
rr0214commented, Aug 18, 2021

If this is still an issue, we recommend reaching out to New Relic support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Nodejs] Type error when creating new WebSocket connection ...
We are making a websocket connection for chat and this error is thrown. Error Message Cannot redefine property: __NR_segment TypeError: ...
Read more >
Why can't I redefine a property in a Javascript object?
You are unable to redefine the property because Object.defineProperty() defaults to non-configurable properties, from the docs: configurable.
Read more >
WebSocket.readyState - Web APIs | MDN
The WebSocket.readyState read-only property returns the current state of the WebSocket connection.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found