Error when use web-ext with chrome with `--keep-profile-changes`?

My ext adds feature to a site that requires login. I want to not have to log in every web-ext run.

In Firefox I achieved this by specifying a custom profile firefoxProfile: 'ext-dev', where the site is logged in beforehand.

In Chrome I attempt to do the same thing by chromiumProfile: 'my/profile/path' and --keep-profile-changes. Chrome launches with the site logged in, but the extension isn’t loaded. The log is stuck at this:

[D:\Admin\projects\hide-ratings\node_modules\.pnpm\web-ext@8.9.0\node_modules\web-ext\lib\extension-runners\chromium.js][debug] Starting Chromium instance...
  LH:ChromeLauncher:verbose created C:\Users\Admin\AppData\Local\Google\Chrome\User Data +0ms
  LH:ChromeLauncher:verbose Launching with command:
  LH:ChromeLauncher:verbose "C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir=C:\Users\Admin\AppData\Local\Google\Chrome\User Data --disable-features=Translate,OptimizationHints,MediaRouter,DialMediaRouteProvider,CalculateNativeWinOcclusion,InterestFeedContentSuggestions,CertificateTransparencyComponentUpdater,AutofillServerCommunication,PrivacySandboxSettings4 --disable-component-extensions-with-background-pages --disable-background-networking --disable-client-side-phishing-detection --disable-sync --metrics-recording-only --disable-default-apps --no-default-browser-check --no-first-run --disable-backgrounding-occluded-windows --disable-renderer-backgrounding --disable-background-timer-throttling --disable-ipc-flooding-protection --password-store=basic --use-mock-keychain --force-fieldtrials=*BackgroundTracing/default/ --disable-hang-monitor --disable-prompt-on-repost --disable-domain-reliability --propagate-iph-for-testing --remote-debugging-pipe --enable-unsafe-extension-debugging --profile-directory=Default www.chess.com +8ms
  LH:ChromeLauncher:verbose Chrome running with pid 12440 on port 0. +26ms

Remove either --keep-profile-changes or chromiumProfile and the extension loads normally again, but it’s not logged in.

I’m not sure the keep-profile-changes switch works in Chrome too.
Even if Firefox it used to be quite buggy so I’ve stopped using it (but that was many years ago).

But this is how I start Chrome now with prepared “template profile” and it works:

web-ext run -t chromium --chromium-profile C:\tmp\chrome_dev_profile --chromium-binary="C:\Program Files\Google\Chrome\Application\chrome.exe"

Also, this time I created my template profile through these instructions, instead of using ‘Add New Profile’ button from the sidebar. I’m sure that made a difference.

1 Like

--keep-profile-changes only works with Firefox. This is documented in web-ext run --help and the web-ext command reference page on extensionsworkshop.com.

1 Like