jas3333 / gptchat_pinecone

MIT License
14 stars 1 forks source link

Error when running server #6

Closed Makarowka3223 closed 1 year ago

Makarowka3223 commented 1 year ago

Hello, After i run the server and wait for DB connection i get this:

$ node server.js
Server listening on port: 5000
MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
    at _handleConnectionErrors (D:\GPT locak\gptchat_pinecone\node_modules\mongoose\lib\connection.js:755:11)
    at NativeConnection.openUri (D:\GPT locak\gptchat_pinecone\node_modules\mongoose\lib\connection.js:730:11)
    at runNextTicks (node:internal/process/task_queues:60:5)
    at listOnTimeout (node:internal/timers:538:9)
    at process.processTimers (node:internal/timers:512:7)
    at async connectDB (file:///D:/GPT%20locak/gptchat_pinecone/utils/connectDB.js:5:25) {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) { 'localhost:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: null,
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined
}

My .env below:

PORT=5000
OPEN_AI_KEY=****************
PINECONE_API=***************
QUERY_URL=https://gpt-da6a30c.svc.us-central1-gcp.pinecone.io/query
UPSERT_URL=https://gpt-da6a30c.svc.us-central1-gcp.pinecone.io/vectors/upsert
MONGODB=mongodb://localhost:27017/gpt    # <- also tried to put gpt.gpt here as the first gpt is the db name and the second is the collection name within db
topK=3

My MongoDB Compass screenshot: image

Can't figure out what i did wrong. Thanks.

jas3333 commented 1 year ago

Try putting in the actual IP mongo is running on. I'm using mongo in a docker container and had to specify the actual IP to get it to work.

Makarowka3223 commented 1 year ago

Actually, changing from localhost to 127.0.0.1 helped me. Damn, this was sooooooo easy and i would say obvious. But your comment lead me to the proper way, thanks.