最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - Nodejs puppeteer.launch() is hanging and timing out - Stack Overflow

programmeradmin0浏览0评论

After the RHEL8 Patching , Suddenly we started noticing this on our servers and Interesting thing is it is working in other environments which are patched with same versions.

Environment details :

RHEL OS version - 4.18.0-553.40.1.el8_10.x86_64, node - v20.18.2, npm - 10.8.2 puppeteer version - 24.4.0 chrome version - linux-134.0.6998.165. It was working exactly before RHEL version upgrade and interesting part is same upgrade happened on all our environments and it broke only specific to our production environment.

Below is the error I am seeing.

TimeoutError: Timed out after 30000 ms while waiting for the WS endpoint URL to appear in stdout! at ChromeLauncher.launch

Below is my test.js snippet

const puppeteer = require('puppeteer');
 
async function run() {
    console.log("Output -- >    ");
        const browser = await puppeteer.launch({
        headless: true
        })
        console.log("The brower is:", browser);
        try{
                console.log("Output -- >    ");
                let page = await browser.newPage()
//        let response=await page.goto('https://URL'); 
                  console.log("Output -- >    ");
        let response=await page.goto('https://URL'); 
                console.log("Output -- >    "+JSON.stringify(response));
    } catch (err) {       
        console.log(err);
    } finally {
        let pages = await browser.pages();
        await Promise.all(pages.map(page => page.close()));
        await browser.close();
        process.exit();
    }
}

The working environments are printing the console.log for browser as below, But the non working environment is hanging at the launch method and it is not even passing through and printing the console.log

The brower is: CdpBrowser { protocol: 'cdp' }

I appreciate any experts looking into this and suggest a solution

发布评论

评论列表(0)

  1. 暂无评论