Grover.to_pdf: ReadableStream is not defined

58 Views Asked by At

I have a Rails app that is using the Grover Ruby gem, and it converts HTML to images perfectly well, but when I try to convert it to a PDF as shown below, I get an error saying the ReadableStream is not defined.

html = ExportController
        .new
        .render_to_string({
                            template: '/export/index',
                            layout: 'pdf'
                          })
pdf = Grover.new(html).to_pdf
send_data pdf, filename: 'export', type: 'application/pdf'

I suspected that this had something to do with the dependencies, but they were all the proper versions and appeared to have no conflicts. I checked the GitHub issues, and there was nothing matching this problem, so I think it's something on my end, but I can't pinpoint it.

1

There are 1 best solutions below

1
Renan Cadore Aguiar On BEST ANSWER

I was having the same problem here, in production, on AWS EC2. It was resolved by downgrading the package to version 21.11.0.

yarn remove puppeteer

yarn add [email protected]