Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly convert results for Puppeteer version 23 (solves discussion #866) #869

Closed
wants to merge 1 commit into from

Conversation

JeppeKnockaert
Copy link
Contributor

@JeppeKnockaert JeppeKnockaert commented Aug 13, 2024

Since Puppeteer 23.0.0, the result returned by Puppeteer is a Uint8Array instead of a Buffer (see puppeteer/puppeteer#12823 and https://github.com/puppeteer/puppeteer/releases/tag/puppeteer-core-v23.0.0).

They state that most code should still work as Node APIs often accept Uint8Arrays. The toString method used by Browsershot requires a Buffer, so we need to convert the result to a Buffer first.

The test I've added succeeds with Puppeteer v22 and v23. In v23 it fails without the change because base64_decode returns false on an invalid base64 string, in v22 it succeeds with or without the change.

The failing tests were introduced by an earlier PR and should be fixed in #871 or #873

This solves this discussion: #866

@freekmurze
Copy link
Member

Fixed by #870

@freekmurze freekmurze closed this Aug 20, 2024
@JeppeKnockaert JeppeKnockaert deleted the fix-pdf-export branch August 20, 2024 09:30
@jan-tricks
Copy link

@freekmurze can you take another look at this? This PR checks whether the result is an array (and thus comes from Puppeteer 23) or whether it is already a buffer. Since the check was lacking from the merged PR we got the white pages on Puppeteer < 23.

@JeppeKnockaert JeppeKnockaert restored the fix-pdf-export branch August 21, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants