0

Hello I am trying to deploy my server to Railway App, but it gives me this error. Why do I need to change my listening to 0.0.0.0:$PORT?

Message: Looks like your app is listening on 127.0.0.1. You may need to listen on 0.0.0.0 instead.

npm WARN config production Use `--omit=dev` instead.
> server@1.0.0 start
> node server.js
(node:20) [MONGOOSE] DeprecationWarning: Mongoose: the `strictQuery` option will be switched back to `false` by default in Mongoose 7. Use `mongoose.set('strictQuery', false);` if you want to prepare for this change. Or use `mongoose.set('strictQuery', true);` to suppress this warning.
(Use `node --trace-deprecation ...` to show where the warning was created)
Listening on port 8000
Something went wrong MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
at NativeConnection.Connection.openUri (/app/node_modules/mongoose/lib/connection.js:825:32)
at /app/node_modules/mongoose/lib/index.js:411:10
at /app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5
at new Promise (<anonymous>)
at promiseOrCallback (/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)
at Mongoose._promiseOrCallback (/app/node_modules/mongoose/lib/index.js:1285:10)
at Mongoose.connect (/app/node_modules/mongoose/lib/index.js:410:20)
at Object.<anonymous> (/app/config/mongoose.config.js:2:10)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10) {
reason: TopologyDescription {
type: 'Unknown',
servers: Map(1) { '127.0.0.1:27017' => [ServerDescription] },
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: null,
maxElectionId: null,
maxSetVersion: null,
commonWireVersion: 0,
logicalSessionTimeoutMinutes: null
},
code: undefined
}

mtvdoan
  • 1
  • 2

0 Answers0