ruimarinho / gsts

Obtain and store AWS STS credentials to interact with Amazon services by authenticating via G Suite SAML.
MIT License
212 stars 37 forks source link

allow setting puppeteer executablePath #21

Closed lizthegrey closed 3 years ago

lizthegrey commented 4 years ago

For my new aarch machine, puppeteer ships with the x86_64 binary still, and that won't be runnable; thus, I need to override executablePath

Is it possible to support a command line flag for specifying a custom chromium to run instead of puppeteer's default? e.g. executablePath: '/usr/bin/chromium-browser'

ruimarinho commented 4 years ago

Yep, sounds good to me. Will try to add that in.

ruimarinho commented 3 years ago

Added in https://github.com/ruimarinho/gsts/commit/f92cda7d4e2fa43c0fea3446ff1c62c7401bb5c3. Let me know if it works for you!

lizthegrey commented 3 years ago

Thanks! Will try!

lizthegrey commented 3 years ago

It works! Also had to jury-rig ln -s ~/snap/chromium/current/.local/share/gsts ~/.local/share/ but after that it was fine (snap sandboxing means that it can't write to ~/.local in my own homedir).

ruimarinho commented 3 years ago

Nice! Would be great to check if it is swallowing write errors due to lack of permissions and attempt to offer an alternative. Does snap sandboxing offer writable destinations by default?

lizthegrey commented 3 years ago

It does, because $HOME is set to /home/$USER/snap/chromium/current/ instead of to /home/$USER by the wrapper script.

The error isn't swallowed, it's in fact prominently shown:

Error: Failed to launch the browser process!
[118971:118971:0812/102856.023343:ERROR:process_singleton_posix.cc(280)] Failed to create /home/lizf/.local/share/gsts/SingletonLock: Permission denied (13)
[118971:118971:0812/102856.023539:ERROR:chrome_browser_main.cc(1246)] Failed to create a ProcessSingleton for your profile directory. This means that running multiple instances would start multiple browser processes rather than opening a new window in the existing process. Aborting now to avoid profile corruption.
[118971:119132:0812/102856.029596:ERROR:disk_cache.cc(184)] Unable to create cache
[118971:119132:0812/102856.029820:ERROR:shader_disk_cache.cc(606)] Shader Cache Creation failed: -2
ruimarinho commented 3 years ago

@lizthegrey which version of Ubuntu are you using? I setup a VM with 18.04, installed Chromium via snap install chromium, set the executable to /snap/chromium/current/usr/lib/chromium-browser/chrome, and it worked without problems. I can also see /home/$USER/.local/share/gsts was created successfully.

There are a few fixes I'm about to publish related to a function that interacts with the filesystem, but your error is happening before the code hits this point.

Could you please log the output of https://github.com/ruimarinho/gsts/blob/master/index.js#L19? Here it shows:

{ data: '/home/$USER/.local/share/gsts',
  config: '/home/$USER/.config/gsts',
  cache: '/home/$USER/.cache/gsts',
  log: '/home/$USER/.local/state/gsts',
  temp: '/tmp/$USER/gsts' }