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

[Bug]: WebP screenshots are always empty #7923

Closed
KevinVR opened this issue Jan 23, 2022 · 1 comment
Closed

[Bug]: WebP screenshots are always empty #7923

KevinVR opened this issue Jan 23, 2022 · 1 comment
Labels

Comments

@KevinVR
Copy link

KevinVR commented Jan 23, 2022

Bug description

Steps to reproduce the problem

  1. Use chrome-aws-lambda as a layer arn:aws:lambda:eu-west-1:764866452798:layer:chrome-aws-lambda:25
  2. Navigate to a page await page.goto(url, {waitUntil: 'networkidle2'});
  3. Take a screenshot result = await page.screenshot({ type: 'webp' });
  4. The screenshot will be empty --> Buffer.byteLength(result) === 0
  5. Looking at the actual buffer, it is really, really empty

This only happens with type: 'webp'. Using jpeg or png works perfectly. Somehow webp is always blank.

Browser

The browser is created in the usual way.

const chromium = require('chrome-aws-lambda');
const puppeteer = require('puppeteer-core');

await puppeteer.launch({
    args: chromium.args,
    defaultViewport: chromium.defaultViewport,
    executablePath: await chromium.executablePath,
    headless: chromium.headless,
    ignoreHTTPSErrors: true,
    dumpio: true
});

Environment

This happens on AWS-Lambda using the above layer ARN (chrome-aws-lambda)

However, I can reproduce it locally. using sam build sam local start-api the exact same issue occurs on Windows.

Puppeteer version

puppeteer-core 13.1.1

Node.js version

14.18.3

npm version

6.14.15

What operating system are you seeing the problem on?

Windows, AWS Lambda (Node 14)

Relevant log output

2022-01-23T16:25:03.914Z        09d98dd9-1ce1-44d7-99b6-2cefa32a1d6e    INFO    Make browser: 900.478ms
2022-01-23T16:25:03.944Z        09d98dd9-1ce1-44d7-99b6-2cefa32a1d6e    INFO    Make new page: 29.81ms
2022-01-23T16:25:03.946Z        09d98dd9-1ce1-44d7-99b6-2cefa32a1d6e    INFO    setViewport: 1.181ms
2022-01-23T16:25:05.139Z        09d98dd9-1ce1-44d7-99b6-2cefa32a1d6e    INFO    takesnap-goto: 1.193s
2022-01-23T16:25:05.139Z        09d98dd9-1ce1-44d7-99b6-2cefa32a1d6e    INFO    Generating image
2022-01-23T16:25:05.209Z        09d98dd9-1ce1-44d7-99b6-2cefa32a1d6e    INFO    Generated file length  0
2022-01-23T16:25:05.466Z        09d98dd9-1ce1-44d7-99b6-2cefa32a1d6e    INFO    S3 Upload: 256.519ms
@KevinVR KevinVR added the bug label Jan 23, 2022
@KevinVR
Copy link
Author

KevinVR commented Jan 23, 2022

Closing this, the reason is that chrome-aws-lambda and the layer arn are only compatible with Puppeteer 10.x right now.

An upgrade needs to happen on the https://github.com/alixaxel/chrome-aws-lambda project first. Opened ticket there: alixaxel/chrome-aws-lambda#254

@KevinVR KevinVR closed this as completed Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant