yumauri / gotenberg-js-client

A simple JS/TS client for interacting with a Gotenberg API
MIT License
111 stars 9 forks source link

Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'. #27

Closed crenardaaaic closed 3 years ago

crenardaaaic commented 3 years ago

Hi, I wanted to use this JS implementation with direct html injection. But when the formData should be implemented I have this error : Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob' Here is the script I used, is there something wrong ?

  const toPDF = pipe(
    gotenberg('http://localhost:3000'),
    convert,
    html,
    please
  )
  const pdf = await toPDF("<html><head></head><body>Make my day</body></html>")
  pdf.pipe(fs.createWriteStream('index.pdf'))`
yumauri commented 3 years ago

Hello! Hm, code looks fine to me... I've just tried exactly the same code and got no error. Can you share version of NodeJS and version of this library you use?

crenardaaaic commented 3 years ago

Wow that's a quick answer, thanks 👍 Here are the versions : Node: v12.16.1 gotenberg-js-client: v0.7.0

By the way, the application is in VueJs 2.0

yumauri commented 3 years ago

Wait, I got suspicious when I saw Blob, because NodeJS doesn't have Blob type, this is browser thing.

This is server-side library.

In theory used approach should possible work in browser, but as for now library is relying on NodeJS types and objects. Sorry...

crenardaaaic commented 3 years ago

Holly molly ... too bad :(

Anyway thanks for your super reactivity 👍

yumauri commented 3 years ago

I've created issue #2 long time ago, to track this feature, but have no time since to escalate :(

I will appreciate for PR to add isomorphic features in this package :)

yumauri commented 3 years ago

mantra I will make this package isomorphic, I will make this package isomorphic, I will...

But for now I'll close this issue