serviejs/popsicle

Exception 'stream.on is not a function' when ArrayBuffer is sent from a node.js app

Closed this issue · 6 comments

Hi,

by using the following (nodejs) code:

var popsicle = require('popsicle');

const buffer = new ArrayBuffer(8);
const uint8 = new Uint8Array(buffer);
uint8.set([1, 2, 3], 3);

const res = popsicle.fetch('http://localhost:52128/arraybuffer',
{
  method: 'POST',
  body: buffer,
  omitDefaultHeaders: true,
  headers: {'Content-Type':'application/octet-stream'}
}).then((res) => console.log(res));

the following exception gets raised 'stream.on is not a function'' (tested with node v12.18.3).

Thanks
Sergio A.

What version of popsicle are you using?

I am using the following versions:

  1. popsicle: ^12.0.6;
  2. servie: ^4.3.3.

This is fixed with the latest release of popsicle-transport-http (serviejs/popsicle-transport-http@0a22abc), if you do npm install popsicle again you should see the latest version installed. I'm back from a vacation now, so I'll look into improving the cross-repo coverage ASAP along with supporting other typed arrays.

I tested the latest version of the popsicle-transport-http package in my project.
Now the request in nodejs works smoothly, without exceptions.
Thank you so much for the bug fixing.
No big deal, everyone deserves a vacation.
I look forward to seeing improved the cross-repo coverage.

Is the dependency "popsicle-transport-http" in popsicle package.json supposed to be updated (from ^1.0.8 to ^1.0.9)?

That’s irrelevant because versioning isn’t pinned, anyone installing will get the latest release.