Shippable / support

Shippable SaaS customers can report issues and feature requests in this repository
100 stars 28 forks source link

Puppeteer: Failed to launch browser process #5101

Closed ryan-kimber closed 4 years ago

ryan-kimber commented 4 years ago

Puppeteer/Chrome failing in Shippable, works locally

Hello awesome Shippable team,

We are attempting to build some real-world testing for our authentication services, and have built tests that work locally using NodeJS, Mocha and Puppeteer, but when they run in Shippable, we get an error that Puppeteer "Failed to launch browser process".

Could you help point us in the right direction?

We are using a node 10.21 image in Shippable. We are running Puppeteer 3.3.0, and we're executing some straight-forward browser commands:

const puppeteer = require('puppeteer');

describe("OpenID - Cognito", function () {

    // Create browser and page variables we can reuse after we've logged in so that they will maintain our session token.
    let browser;
    let page;

    this.timeout(20000);

    it("Can Login via Cognito and get redirected to chosen URI", async function() {
        //The auth-route for our OpenId provider in test is /cognito (live would be /auth/cognito)
        browser =  await puppeteer.launch({
            headless: true,
            args: ['--no-sandbox', '--disable-setuid-sandbox',  "--disable-gpu"]
        });

        page = await browser.newPage();
        // await page.waitFor(10000);

        let result = await Promise.all([
            page.goto('http://localhost:3001/cognito/authorize?targetUrl=http://localhost:3001/'),
            page.waitForNavigation()
        ]);

        await page.type('#signInFormUsername', 'abc@test.com');
        await page.type('#signInFormPassword', 'xyz');
        await page.click('input[type=submit]');
        await page.waitForNavigation();
        let bodyText = await page.$eval('body', bodyElement => bodyElement.innerText);
        return Promise.all([
            expect(bodyText).to.be.a('string').and.satisfy(msg => msg.startsWith('NOT BUILT FOR DOCKER YET'))
        ]);
    });

Console for failed shippable build: https://app.shippable.com/github/formhero/fh-auth-service/runs/753/1/console

Any guidance you can offer would be greatly appreciated!

Thanks Shippable team,

Ryan

ryan-kimber commented 4 years ago

I have figured it out. There were missing Chromium dependencies in my underlying image.

ryan-kimber commented 4 years ago

Sorry for the trouble @Shippable team!

For anyone else that runs into something like this, I found the Puppeteer Docker & Alpine troubleshooting documentation to be quite helpful.