yGuy / chatgpt-mattermost-bot

A very simple implementation of a service for a mattermost bot that uses ChatGPT in the backend.
MIT License
150 stars 48 forks source link

ETIMEDOUT when trying to Fetch #29

Closed bronlund closed 1 year ago

bronlund commented 1 year ago

I think I have gotten everything right, but the docker logs just show the following error (URL and IP are edited :):

/app/node_modules/node-fetch/lib/index.js:1505
                        reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
                               ^
FetchError: request to https://example.com/api/v4/users/me failed, reason: connect ETIMEDOUT 123.456.789.000:443
    at ClientRequest.<anonymous> (/app/node_modules/node-fetch/lib/index.js:1505:11)
    at ClientRequest.emit (node:events:513:28)
    at TLSSocket.socketErrorListener (node:_http_client:494:9)
    at TLSSocket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}

I can get the bot to respond using curl, but there seems to be nothing going on the docker side of things.

yGuy commented 1 year ago

I take it "example.com" is your true mattermost API endpoint and the IP is also the correct one? Looks like the bot (or the docker image) cannot reach the API endpoint for some reasons. Can you reach the API endpoint from within the docker image's console via curl?

I don't think this is an issue with the bot, but with the network configuration.