ikechan8370 / node-chatgpt-proxy

a stable proxy solution of chat.openai.com which can bypass cloudflare with browser
Apache License 2.0
92 stars 17 forks source link

程序无法正常运行起来 #3

Closed dvc890 closed 1 year ago

dvc890 commented 1 year ago

通过docker运行你的镜像后,一直反复重启proxy进程,定位了一下,是在this.browser = await puppeteer.launch(this.config)执行后就崩了,catch捕捉不到

> % docker exec -it node-chatgpt-proxy tail -f /var/log/node-chatgpt-proxy.log

init chatgpt browser
node-chatgpt-proxy listening on port 3000
chatgpt puppeteer 启动中...

> node-chatgpt-proxy@1.0.0 start
> node src/main.js

init chatgpt browser
node-chatgpt-proxy listening on port 3000
chatgpt puppeteer 启动中...

> node-chatgpt-proxy@1.0.0 start
> node src/main.js

init chatgpt browser
node-chatgpt-proxy listening on port 3000
chatgpt puppeteer 启动中...

> node-chatgpt-proxy@1.0.0 start
> node src/main.js

init chatgpt browser
node-chatgpt-proxy listening on port 3000
chatgpt puppeteer 启动中...
2023-04-04 14:03:26,438 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2023-04-04 14:03:26,443 INFO supervisord started with pid 1
2023-04-04 14:03:27,472 INFO spawned: 'xvfb' with pid 9
2023-04-04 14:03:27,487 INFO spawned: 'proxy' with pid 11
2023-04-04 14:03:28,497 INFO success: xvfb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-04-04 14:03:28,498 INFO success: proxy entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-04-04 14:03:34,252 INFO exited: proxy (exit status 1; not expected)
2023-04-04 14:03:34,252 INFO reaped unknown pid 85 (exit status 0)
2023-04-04 14:03:34,252 INFO reaped unknown pid 90 (exit status 0)
2023-04-04 14:03:34,252 INFO reaped unknown pid 76 (exit status 0)
2023-04-04 14:03:34,253 INFO reaped unknown pid 78 (exit status 0)
2023-04-04 14:03:35,267 INFO spawned: 'proxy' with pid 105
2023-04-04 14:03:36,272 INFO success: proxy entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-04-04 14:03:41,546 INFO exited: proxy (exit status 1; not expected)
2023-04-04 14:03:41,546 INFO reaped unknown pid 157 (exit status 0)
2023-04-04 14:03:41,546 INFO reaped unknown pid 162 (exit status 0)
2023-04-04 14:03:41,546 INFO reaped unknown pid 148 (exit status 0)
2023-04-04 14:03:41,547 INFO reaped unknown pid 150 (exit status 0)
2023-04-04 14:03:42,561 INFO spawned: 'proxy' with pid 177
2023-04-04 14:03:43,566 INFO success: proxy entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-04-04 14:03:49,076 INFO exited: proxy (exit status 1; not expected)
2023-04-04 14:03:49,077 INFO reaped unknown pid 229 (exit status 0)
2023-04-04 14:03:49,077 INFO reaped unknown pid 234 (exit status 0)
2023-04-04 14:03:49,077 INFO reaped unknown pid 220 (exit status 0)
2023-04-04 14:03:49,077 INFO reaped unknown pid 222 (exit status 0)
2023-04-04 14:03:50,092 INFO spawned: 'proxy' with pid 249
2023-04-04 14:03:51,097 INFO success: proxy entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-04-04 14:03:56,542 INFO exited: proxy (exit status 1; not expected)
ikechan8370 commented 1 year ago

是否是配置过低?

dvc890 commented 1 year ago

是否是配置过低?

那需要给docker配置什么样的配置呢?我在本地测试的配置如下:(我是m1笔记本跑的docker) CPUs:4 Memory:7.9 GB Swap:1.5 GB Virtual disk limit:64 GB

ikechan8370 commented 1 year ago

这个配置足够,我的集群都跑在1H1G的机器上。你是m1的话,用的是哪个镜像?我这个目前只做了x86_64的,没支持arm。你要跑在m1上的话,需要对应修改Dockerfile。 https://github.com/ikechan8370/node-chatgpt-proxy/blob/3238c54bb436999c4fdf50e9a44192b586d1468c/Dockerfile#L6

dvc890 commented 1 year ago

我在前面加了“DOCKER_DEFAULT_PLATFORM=linux/amd64”,让他强制走转译

immoke commented 3 months ago

大神好,我现在部署,依然出现这个issues一样的报错, 我先是在华为云1c1g上部署报错,然后考虑可能是配置问题,又换本地的4c4g部署,依然报错。 请问如何解决?

ikechan8370 commented 3 months ago

大神好,我现在部署,依然出现这个issues一样的报错, 我先是在华为云1c1g上部署报错,然后考虑可能是配置问题,又换本地的4c4g部署,依然报错。 请问如何解决?

docker exec -it node-chatgpt-proxy tail -f /var/log/node-chatgpt-proxy_error.log

用这个看看有没有错误日志

immoke commented 3 months ago

大神好,我现在部署,依然出现这个issues一样的报错, 我先是在华为云1c1g上部署报错,然后考虑可能是配置问题,又换本地的4c4g部署,依然报错。 请问如何解决?

docker exec -it node-chatgpt-proxy tail -f /var/log/node-chatgpt-proxy_error.log

用这个看看有没有错误日志

下面是错误日志: /node-chatgpt-proxy/node_modules/.pnpm/puppeteer-core@19.7.2/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Frame.js:240 ? new Error(${response.errorText} at ${url}`) ^

Error: net::ERR_INVALID_AUTH_CREDENTIALS at https://chatgpt.com/ at navigate (/node-chatgpt-proxy/node_modules/.pnpm/puppeteer-core@19.7.2/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Frame.js:240:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Frame.goto (/node-chatgpt-proxy/node_modules/.pnpm/puppeteer-core@19.7.2/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Frame.js:206:21) at async CDPPage.goto (/node-chatgpt-proxy/node_modules/.pnpm/puppeteer-core@19.7.2/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:439:16) at async ChatGPTPuppeteer.init (/node-chatgpt-proxy/src/browser/full-browser.js:167:7)

Node.js v18.20.2 `

ikechan8370 commented 3 months ago

大神好,我现在部署,依然出现这个issues一样的报错, 我先是在华为云1c1g上部署报错,然后考虑可能是配置问题,又换本地的4c4g部署,依然报错。 请问如何解决?

docker exec -it node-chatgpt-proxy tail -f /var/log/node-chatgpt-proxy_error.log

用这个看看有没有错误日志

下面是错误日志: /node-chatgpt-proxy/node_modules/.pnpm/puppeteer-core@19.7.2/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Frame.js:240 ? new Error(${response.errorText} at ${url}`) ^

Error: net::ERR_INVALID_AUTH_CREDENTIALS at https://chatgpt.com/ at navigate (/node-chatgpt-proxy/node_modules/.pnpm/puppeteer-core@19.7.2/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Frame.js:240:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Frame.goto (/node-chatgpt-proxy/node_modules/.pnpm/puppeteer-core@19.7.2/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Frame.js:206:21) at async CDPPage.goto (/node-chatgpt-proxy/node_modules/.pnpm/puppeteer-core@19.7.2/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:439:16) at async ChatGPTPuppeteer.init (/node-chatgpt-proxy/src/browser/full-browser.js:167:7)

Node.js v18.20.2 `

你是不是用了代理呢?

immoke commented 3 months ago

是的……我以为国内的机器不能直接访问,所以配了个HTTP代理,我去掉一下重新部署实施,非常感谢。

ikechan8370 commented 3 months ago

是的……我以为国内的机器不能直接访问,所以配了个HTTP代理,我去掉一下重新部署实施,非常感谢。

境内部署这个应该是需要代理。但你这个好像是需要用户名密码 然后chrome目前还不支持带用户名密码的代理

immoke commented 3 months ago

是的……我以为国内的机器不能直接访问,所以配了个HTTP代理,我去掉一下重新部署实施,非常感谢。

境内部署这个应该是需要代理。但你这个好像是需要用户名密码 然后chrome目前还不支持带用户名密码的代理

非常感谢,是的,我的代理因为公网能访问,所以加了个账号密码,那可能就是这个问题了。 本地测试了一下,curl http://127.0.0.1:8901/backend-api/conversation {"status":405,"statusText":"","body":{"detail":"Method Not Allowed"},"error":{"statusCode":405,"statusText":""}},我理解应该是可以用的,再次感谢。