agentic
agentic copied to clipboard
Incorrect assumption of Linux Chrome binary
Verify latest release
- [X] I verified that the issue exists in the latest
chatgptrelease
Verify webapp is working
- [X] I verify that the ChatGPT webapp is working properly for this account.
Verify resrictions
- [X] I verify that I've double-checked all of the restrictions.
Environment details
Node.js version: v19.2.0 Browser version: ungoogled-chromium (flatpak) OS: Arch Linux
Link to the code that reproduces this issue
https://github.com/transitive-bullshit/chatgpt-api/blob/main/src/openai-auth.ts#L225
Describe the Bug
The puppeteer config for linux is lacking in that it simply hardcodes two potential paths to chrome (/usr/bin/google-chrome, /usr/bin/google-chrome-stable). This can be bypassed by editing the source at https://github.com/transitive-bullshit/chatgpt-api/blob/main/src/openai-auth.ts#L225 but it would be much more convenient for .env to include an optional variable like BROWSER_PUPPETEER_PATH.
To Reproduce
- Don't have Chrome installed
- be on Linux
- Have ungoogled-chromium installed and set as default browser
- Run
- Error:
Error: Failed to launch the browser process! spawn /usr/bin/google-chrome-stable ENOENT
Expected Behavior
Expectation would be that puppeteer either installs its own chromium instance, or doesn't assume the path to browser.
@luphoria that sounds great which would override the default platform logic. Would you be down to open a PR for this?
I might when I have a little more time. I'm much more of a monkeypatcher than I am a programmer :P
I'll have a go at making a PR that adds a chromePath or browserPath vaiable to the ChatGPTAPIBrowser opts.
It is definitely worth adding something to work with other Linux distributions.
However, there is already such a feature in puppeteer.
import { executablePath } from 'puppeteer'
Why not use it? It detects your path. And also you can use env variable PUPPETEER_EXECUTABLE_PATH with it.
Added PR. https://github.com/transitive-bullshit/chatgpt-api/pull/150
https://github.com/transitive-bullshit/chatgpt-api/releases/tag/v2.5.1 should help.
@RusDyn see my comment on your PR; we can't use the default puppeteer executable path due to cloudflare.