Properly convert results for Puppeteer version 23 (solves discussion #866) #869
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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