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.

Using existing userDataDir causes unknown failure with open tabs

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.13.0
  • Platform / OS version: MacOS 10.13.6 and Chrome 74
  • URLs (if applicable):
  • Node.js version: 10.15.3

What steps will reproduce the problem?

I’m running this very basic code below and attempting to run puppeteer using my own chrome profile with userDataDir.

const puppeteer = require('puppeteer');
(async () => {
    try {
        const browser = await puppeteer.launch({
            executablePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
            headless: false,
            userDataDir: '/Users/xxxx/Library/Application Support/Google/Chrome'
        });
        const page = await browser.newPage();
        page.on('console', msg => console.log('PAGE LOG:', msg.text()));
        await page.goto('https://google.com');
        await page.waitFor(10000);
        await browser.close();
    }
    catch (e)
    {
        console.log(e)
    }
})();

What is the expected result? Opening a new tab in my already open browser with my user profile.

What happens instead?

It fails silently (without any error message). An about:blank page does open as normal, but the other tab (google.com) does not.

$ node index.js
Error: Failed to launch chrome!


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (/Users/xxxx/.../node_modules/puppeteer/lib/Launcher.js:342:14)
    at ChildProcess.helper.addEventListener (/Users/xxxx/.../node_modules/puppeteer/lib/Launcher.js:332:60)
    at ChildProcess.emit (events.js:194:15)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)

Weirdly however, it does work somewhat when chrome is quit completely. It opens a new chrome with the correct, unsynced, profile. It also works when headless is set to true. It seems to be similar to issue 2099.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
aslushnikovcommented, Jul 15, 2019

Folks, please don’t run two browser instances that point to the same chromium profile. This will result in undefined behavior.

2reactions
maurijnvdcommented, Jan 11, 2022

Did you have any luck with this @TomasHubelbauer ? I have a similar issue - I have tried copying the chrome profile but got the same error as using Default, just wondering if you managed to get it working.

I had the same issue, it was fixed by the following 2 steps.

  1. run service in Safari(or any other browser except chrome)
  2. set the userDataDir to “/Users/YOURNAME/Library/Application\ Support/Google/Chrome/” beware the directory “default” was removed

Hi @zhiqinx what do you mean by ‘run service in safari’? What do i have to run in safari. I didn’t really get that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to use user-data-dir but for multiple puppeteer windows
So what I am trying to do is to open puppeteer window with my google profile, but what I want is ...
Read more >
Chrome --user-data-dir not working properly?
The User Data folder is the profile. Copy the existing C:\Users\username\AppData\Local\Google\Chrome\User Data folder to something like ...
Read more >
79 - Allow user to specify template user data dir - chromedriver
Use the following bat file to start ChromeDriver ... I was wondering what causes the channel automation error that I see when I...
Read more >
Open Browser with Custom Profile - Katalon Studio
I would use an existing Chrome user (no matter how it is named I should ... Error: Reason: org.openqa.selenium.WebDriverException: unknown ...
Read more >
Downloads - ChromeDriver - WebDriver for Chrome
If you are using Chrome version 94, please download ChromeDriver 94.0. ... Resolved issue 3690: ChromeDriver fails if extensions use chrome.windows API.
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