matrix-docker-ansible-deploy
matrix-docker-ansible-deploy copied to clipboard
matrix-bot-chatgpt - "OpenAI-API Error: TypeError: fetch failed"
Describe the bug
Tried out the new chatgpt bot today but it's failing to respond when pinged, it produced this error:
Feb 13 10:38:31 pagrus matrix-bot-chatgpt[26104]: Mon, 13 Feb 2023 02:38:31 GMT [INFO] [index] Bot started!
Feb 13 10:38:49 pagrus matrix-bot-chatgpt[26104]: Mon, 13 Feb 2023 02:38:49 GMT [ERROR] [OpenAI-API Error: TypeError: fetch failed]
Feb 13 10:38:49 pagrus matrix-bot-chatgpt[26104]: TypeError: Cannot read properties of undefined (reading 'response')
Feb 13 10:38:49 pagrus matrix-bot-chatgpt[26104]: at CommandHandler.onMessage (file:///usr/src/app/dist/handlers.js:128:86)
Feb 13 10:38:49 pagrus matrix-bot-chatgpt[26104]: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Feb 13 10:38:49 pagrus matrix-bot-chatgpt[26104]: Mon, 13 Feb 2023 02:38:49 GMT [ERROR] [MatrixHttpClient] (REQ-19) { errcode: 'M_NOT_FOUND', error: 'Event not found.' }
Feb 13 10:39:28 pagrus matrix-bot-chatgpt[26104]: Mon, 13 Feb 2023 02:39:28 GMT [ERROR] [OpenAI-API Error: TypeError: fetch failed]
Feb 13 10:39:28 pagrus matrix-bot-chatgpt[26104]: TypeError: Cannot read properties of undefined (reading 'response')
Feb 13 10:39:28 pagrus matrix-bot-chatgpt[26104]: at CommandHandler.onMessage (file:///usr/src/app/dist/handlers.js:128:86)
Feb 13 10:39:28 pagrus matrix-bot-chatgpt[26104]: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Feb 13 10:39:28 pagrus matrix-bot-chatgpt[26104]: Mon, 13 Feb 2023 02:39:28 GMT [ERROR] [MatrixHttpClient] (REQ-34) { errcode: 'M_NOT_FOUND', error: 'Event not found.' }
Feb 13 10:51:07 pagrus matrix-bot-chatgpt[26104]: Mon, 13 Feb 2023 02:51:07 GMT [ERROR] [OpenAI-API Error: TypeError: fetch failed]
Feb 13 10:51:07 pagrus matrix-bot-chatgpt[26104]: TypeError: Cannot read properties of undefined (reading 'response')
Feb 13 10:51:07 pagrus matrix-bot-chatgpt[26104]: at CommandHandler.onMessage (file:///usr/src/app/dist/handlers.js:128:86)
Feb 13 10:51:07 pagrus matrix-bot-chatgpt[26104]: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Feb 13 10:51:08 pagrus matrix-bot-chatgpt[26104]: Mon, 13 Feb 2023 02:51:08 GMT [ERROR] [MatrixHttpClient] (REQ-89) { errcode: 'M_NOT_FOUND', error: 'Event not found.'
It's worth noting our server is behind a wireguard proxy and this has caused us to require workarounds in the past: https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/2314
Here's a more verbose output of the bug:
Feb 13 12:46:04 pagrus systemd[1]: Started Matrix chatgpt bot.
Feb 13 12:46:10 pagrus matrix-bot-chatgpt[1126]: yarn run v1.22.19
Feb 13 12:46:10 pagrus matrix-bot-chatgpt[1126]: $ node --enable-source-maps dist/index.js
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: Mon, 13 Feb 2023 04:46:13 GMT [ERROR] [MatrixHttpClient] (REQ-1) Error: getaddrinfo ENOTFOUND matrix-synapse-reverse-proxy-companion
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: at __node_internal_ (node:internal/errors:712:10)
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: errno: -3008,
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: code: 'ENOTFOUND',
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: syscall: 'getaddrinfo',
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: hostname: 'matrix-synapse-reverse-proxy-companion'
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: }
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: node:internal/process/promises:289
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: triggerUncaughtException(err, true /* fromPromise */);
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: ^
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: Error: getaddrinfo ENOTFOUND matrix-synapse-reverse-proxy-companion
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: at __node_internal_ (node:internal/errors:712:10)
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: errno: -3008,
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: code: 'ENOTFOUND',
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: syscall: 'getaddrinfo',
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: hostname: 'matrix-synapse-reverse-proxy-companion'
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: }
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: Node.js v19.6.0
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: error Command failed with exit code 1.
Feb 13 12:46:13 pagrus matrix-bot-chatgpt[1126]: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Feb 13 12:46:14 pagrus systemd[1]: matrix-bot-chatgpt.service: Main process exited, code=exited, status=1/FAILURE
Feb 13 12:46:14 pagrus systemd[1]: matrix-bot-chatgpt.service: Failed with result 'exit-code'.
Feb 13 12:46:44 pagrus systemd[1]: matrix-bot-chatgpt.service: Service RestartSec=30s expired, scheduling restart.
Feb 13 12:46:44 pagrus systemd[1]: matrix-bot-chatgpt.service: Scheduled restart job, restart counter is at 1.
Feb 13 12:46:44 pagrus systemd[1]: Stopped Matrix chatgpt bot.
To Reproduce
My vars.yml file looks like this:
matrix_bot_chatgpt_enabled: true
# Obtain a new API key from https://platform.openai.com/account/api-keys
matrix_bot_chatgpt_openai_api_key: 'openai-access-token'
# This is the default username
matrix_bot_chatgpt_matrix_bot_username_localpart: 'chatgpt'
# Matrix access token (from bot user above)
matrix_bot_chatgpt_matrix_access_token: 'matrix-access-token'
matrix_bot_chatgpt_matrix_homeserver_url: 'http://matrix-synapse-reverse-proxy-companion:8008'
matrix_bot_chatgpt_matrix_autojoin: false
Expected behavior A clear and concise description of what you expected to happen.
I expected it to succeed in probing the homeserver container and OpenAI service.
Matrix Server:
- OS: Debian 10
- Architecture: amd64
Is matrix_bot_chatgpt_matrix_homeserver_url incorrect by default, so that you're finding the need to explicitly set it to http://matrix-synapse-reverse-proxy-companion:8008?
Is matrix-synapse-reverse-proxy-companion up? The chatgpt bot seems to be complaining that it can't reach it. Perhaps there's some trouble there. Some services were failing to start on certain deployments yesterday, before 6cda711c0b74ccb6ec192c fixed it. It may be related.
Read this: https://github.com/matrixgpt/matrix-chatgpt-bot (first page). IMHO at the moment the bot doenst work caused by openai restrictions.
Is
matrix_bot_chatgpt_matrix_homeserver_urlincorrect by default, so that you're finding the need to explicitly set it tohttp://matrix-synapse-reverse-proxy-companion:8008?
It actually produces the same bug with both, it was just a fix I tried previously.
Is
matrix-synapse-reverse-proxy-companionup? The chatgpt bot seems to be complaining that it can't reach it. Perhaps there's some trouble there. Some services were failing to start on certain deployments yesterday, before 6cda711 fixed it. It may be related.
Yes it's up:
root@pagrus:~# docker ps -a | grep matrix-synapse-reverse-proxy-companion
d81548c0089a nginx:1.23.3-alpine "/docker-entrypoint.…" 11 hours ago Up 11 hours 80/tcp matrix-synapse-reverse-proxy-companion
root@pagrus:~# ping http://matrix-synapse-reverse-proxy-companion
ping: http://matrix-synapse-reverse-proxy-companion: Name or service not known
root@pagrus:~# systemctl status matrix-synapse-reverse-proxy-companion
● matrix-synapse-reverse-proxy-companion.service - Synapse reverse-proxy companion
Loaded: loaded (/etc/systemd/system/matrix-synapse-reverse-proxy-companion.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-02-14 06:05:54 AWST; 11h ago
Read this: https://github.com/matrixgpt/matrix-chatgpt-bot (first page). IMHO at the moment the bot doenst work caused by openai restrictions.
I tried changing the model to a working one with the following extra variable:
matrix_bot_chatgpt_environment_variables_extension: 'CHATGPT_MODEL=text-davinci-003'
But it still produces the same error:
Feb 14 17:44:54 pagrus matrix-bot-chatgpt[26895]: Tue, 14 Feb 2023 09:44:54 GMT [ERROR] [OpenAI-API Error: TypeError: fetch failed]
Feb 14 17:44:54 pagrus matrix-bot-chatgpt[26895]: TypeError: Cannot read properties of undefined (reading 'response')
Feb 14 17:44:54 pagrus matrix-bot-chatgpt[26895]: at CommandHandler.onMessage (file:///usr/src/app/dist/handlers.js:128:86)
Feb 14 17:44:54 pagrus matrix-bot-chatgpt[26895]: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Feb 14 17:44:54 pagrus matrix-bot-chatgpt[26895]: Tue, 14 Feb 2023 09:44:54 GMT [ERROR] [MatrixHttpClient] (REQ-56) { errcode: 'M_NOT_FOUND', error: 'Event not found.' }
I don't think this add-on will really work until it starts using the new OpenAI API interface. Feel free to close this issue if there's no more discussion.
Here's how i got it to work .
matrix_bot_chatgpt_environment_variables_extension: 'CHATGPT_MODEL=text-davinci-003'
without any other matrix_bot_chatgpt_environment_variables_extension
The yml only accepts one matrix_bot_chatgpt_environment_variables_extension and accepts only the last one so it was defaulting to #matrix_bot_chatgpt_environment_variables_extension: 'MATRIX_ENCRYPTION=false'
for me.
Now it works also for me, cooool!
Now it works also for me, cooool!
your chat bot still work with this or do you have to buy credit now?
i cant get it working
No, it's only work with a valid key...
did you free key one run out?