Cannot read property 'bytesRead' of null

I have a script that downloads a resource from AWS S3 and tries to upload it to our servers. The script works on local machines and also is working from time to time on the newRelic servers. But most of the time, on the newRelicServers it errors with the following error:
“Cannot read property ‘bytesRead’ of null”

The script just GET a public png. Then creates an options object similar to this one:

options.method = 'POST';
options.uri = 'something valid'
options.formData = {
  content: {
    value: resp, //response from the aws S3 request
    options: {
      filename : name,
      contentType: 'image/png'

Then makes a request(options, callback). And this yields the error:
Cannot read property ‘bytesRead’ of null

Also, this stack trace is displayed:
TypeError: Cannot read property ‘bytesRead’ of null
at IncomingMessage. (/opt/runtimes/2.0.0/node_modules/speed-tracer/lib/populators.js:157:55)
at IncomingMessage.emit (events.js:129:20)
at IncomingMessage.source.emit (/opt/runtimes/2.0.0/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js:30:21)
at (_stream_readable.js:373:10)
at flow (stream_readable.js:750:26)
at resume
at _stream_readable.js:717:7
at process._tickCallback (node.js:355:11)

Are there any limits that we hit when the script fails? What would be a good practice to consider when uploading images to our servers from api tests?


Hi @ccibu - Not sure if this post about reading files from outside of New Relic would help with your issue.

1 Like

Hey @ccibu – thank you for posting the script snippet and resulting stack trace. Given the stack trace you provided, I suspect this error is related to a known issue our Development Team is actively investigating. That said, would you mind PMing me a direct link to this Synthetics monitor so we could take a closer look?


The script is pretty complex and doing lots of stuff. I have commented out some of the lines so it only does relevant stuff.

Relevant code is from line 200 to line 257.

1 Like

Hi @ccibu thanks for providing the direct link to the API script. I performed some additional testing, and I would like to bring this conversation into a support ticket. Keep an eye on your inbox!

Hi @btribbia

Is there any update on this issue? We are anxiously awaiting for this to be resolved to shore up our monitoring.


Hi @cabral – it looks like a fix for this particular issue went out a little less than 1 month ago. Are you still encountering the Cannot read property 'bytesRead' of null message from your monitors? If so, please PM me a direct link to an affected monitor and I’ll take a look!

1 Like