rialto-php / puphpeteer

A Puppeteer bridge for PHP, supporting the entire API.
MIT License
1.34k stars 204 forks source link

Unexpected end of JSON input for large pages #87

Open NikolayMurha opened 4 years ago

NikolayMurha commented 4 years ago

Describe the bug When I call $page->setContent($html) for large page, I have error Unexpected end of JSON input After investigation I found problem in the "@nesk/rialto" packge:

https://github.com/nesk/rialto/blob/dev/src/node-process/Connection.js#L49

 socket.on('data', data => {
      this.emit('activity');

      this.handleSocketData(data);
  });

For large content data limited by 65536 bytes max and should be read by chunks.

As temporary workaround I put content to temporary html file and call $page->goto('file://' . $this->tempFile); instead of $page->setContent($html);

Expected behavior Render content without errors.

Environment (please complete the following information):

My Node package manager is:

chriscachor commented 4 years ago

I'm seeing the same issue

ernst77 commented 3 years ago

Is anyone fixing this?

nesk commented 3 years ago

I'm working on improving the communication between PHP and Node processes, I can't provide you an estimation though. It will improve the following topics:

mokhosh commented 3 years ago

Same issue. And thank you @nesk for working on this.

ekkode commented 3 years ago

I have the same issue.

petrukhanlt commented 3 years ago

The same

sngrl commented 3 years ago

Still have the same error :(

MarGul commented 3 years ago

Still have the same error as well :/

erajakos commented 2 years ago

Remember to add the ".html" extension when using the temporary HTML file workaround described by @NikolayMurha. Dummy thing, but I was figuring out for a moment why the PDF showed the source code only. 😄