question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Protocol error (Page.captureScreenshot): Target closed" when trying to take a fullpage-screenshot from a huge page

See original GitHub issue

We’re using docker container like that:

FROM ......

# Install missing shared libs for Chromium
RUN apt-get update && \
    apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
    libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
    libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
    libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
    ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

# Project
COPY ./ /app
WORKDIR /app

# Install puppeteer so it's available in the container
RUN npm i --production

# Info
RUN npm -v
RUN node -v

# Run
ENTRYPOINT ["npm", "start"]

npm start starts a simple server that takes a screenshot for specified page. Inside this container we’re getting an error Protocol error (Page.captureScreenshot): Target closed. when fullPage property is true and trying to take a screenshot from a huge page (e.g. https://blog.archive.org/).

In a local machine, everything is fine.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
codersbrewcommented, Jan 17, 2018

@aslushnikov

  puppeteer.launch({
    ignoreHTTPSErrors: true,
    args: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage']
  }).then(async browser => {
2reactions
smelukovcommented, Feb 27, 2018

--disable-dev-shm-usage works. Tanks! ✅

Read more comments on GitHub >

github_iconTop Results From Across the Web

Protocol error (Page.captureScreenshot): Target closed when ...
captureScreenshot ): Target closed. when fullPage property is true and trying to take a screenshot from a huge page. In a local machine, ......
Read more >
Protocol error (Page.captureScreenshot): Target closed ...
Your issue is not reproducible. It works on my Centos 7, your Mac environment, so it seems to be a problem with the...
Read more >
Error - Target closed - Checkly
Example error message: UnhandledPromiseRejectionWarning: Error: Protocol error: Target closed Possible causes Obvious possible cause: the browser, ...
Read more >
1164757 - Capture full size screenshot is broken - Monorail
Issue 1164757: Capture full size screenshot is broken: Incorrect pixel dimensions · 1. Navigate to https://developer.mozilla.org/en-US/ · 2. CTRL+ ...
Read more >
Puppeteer - CodeceptJS
don't save screenshot on failure. fullPageScreenshots boolean (opens new window)? make full page screenshots on failure.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found