browser.newPage freezes (never resolves)
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.12.2
- Platform / OS version: Ubuntu 16.04.5 & macOS
- Node.js version: 11.10
What steps will reproduce the problem?
Here’s the exact code I’m using:
const browser = await puppeteer.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox', '--lang=en-GB'],
});
const page = await browser.newPage();
With the following dockerfile:
FROM node:11
########################################################################################################################
# Puppeteer Begin
########################################################################################################################
# See https://crbug.com/795759
RUN apt-get update && apt-get install -yq libgconf-2-4
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer installs, work.
RUN apt-get update && apt-get install -y wget --no-install-recommends \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get purge --auto-remove -y curl \
&& rm -rf /src/*.deb
########################################################################################################################
# Puppeteer End
########################################################################################################################
# Create app directory
WORKDIR /usr/src/app
# Install dependencies
COPY package.json .
COPY package-lock.json .
RUN npm install
# Bundle remaining sources
COPY . .
EXPOSE 3000
CMD [ "node", "./bin/www" ]
What is the expected result?
I expect the browser.newPage
promise to always resolve or reject.
What happens instead?
After running this code for several hours with many iterations of the above code snippet, the browser.newPage
promise will eventually not resolve nor reject causing my application to hang.
Note: Problem goes away when downgrading to puppeteer 1.11.0
Edit: Actually, downgrading to 1.11.0 did not help…
See older similar issue: https://github.com/GoogleChrome/puppeteer/issues/1409#issuecomment-464866096
Issue Analytics
- State:
- Created 5 years ago
- Reactions:12
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Puppeteer newPage() freezes/ never resolves nor rejects ...
My Problem is that the browser.newPage() function never resolves. So basicly in the console it alsways loggs Start but never 1 nor 2....
Read more >Puppeteer causes Firefox to freeze because stdout/stderr ...
It simply loads the given page, and then quits the browser. But closing the browser hangs, and Firefox never quits. Even the shutdown...
Read more >Puppeteer browser hanged on newPage() on Web App ...
I have published a node.js to Web App Service (Linux with Node 14) that using puppeteer browser to download pdf.
Read more >Getting to Know Puppeteer Using Practical Examples
In the code example above we plainly create a new page by invoking the newPage method. Notice it's created on the default browser...
Read more >Page | Playwright - CukeTest
Page provides methods to interact with a single tab in a Browser, ... the page will freeze waiting for the dialog, and actions...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I solved the problem by setting the browser to use pipe instead of websocket:
const browser = await puppeteer.launch({ pipe: true });
Having the same problem I managed to fix it this way :
Then in my code:
Hope this can be helpful.