Open Dr4gon opened 1 year ago
@echo75 Of course, you'll both in the front- and backend an .env file. I'm aware that you have your secrets stored there. But u need to at least provide a dummy .env file to make it locally work for every developer after u.
Yeah, that would be nice. I know from other projects that it's MONGODB_CONNECTION_STRING=mongodb://mongo:27017 which u changed to MONGODB_URI and therefore the app crashes.
graduation-project-johan-hedman-api-1 | app.js is running
graduation-project-johan-hedman-api-1 | /app/node_modules/connect-mongo/build/main/lib/MongoStore.js:126
graduation-project-johan-hedman-api-1 | .db(options.dbName)
graduation-project-johan-hedman-api-1 | ^
graduation-project-johan-hedman-api-1 |
graduation-project-johan-hedman-api-1 | TypeError: Cannot read properties of undefined (reading 'db')
graduation-project-johan-hedman-api-1 | at /app/node_modules/connect-mongo/build/main/lib/MongoStore.js:126:18
graduation-project-johan-hedman-api-1 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
graduation-project-johan-hedman-api-1 |
graduation-project-johan-hedman-api-1 | Node.js v20.5.1
graduation-project-johan-hedman-api-1 |
graduation-project-johan-hedman-api-1 | [nodemon] app crashed - waiting for file changes before starting...
After changing the configuration value to MONGODB_URI, the app finally starts properly 😁
There is a .env.example in the front-and backend though, with the parameters you need
@johan-hedman I'm aware of that. A newbie won't know what an .env file is or how to use it properly. It would be much easier to simply start the application 😁
@johan-hedman I copied this directly into my .env file
MONGODB_URI = mongodb://localhost:27017/movies-test
SESSION_SECRET = 1234567890ABCDEFabcdef
FRONTEND_URL = http://127.0.0.1:5173
OMDB_API_KEY = 11111111
The application doesn't let me even see the page anymore
frontend_1 | ➜ Local: http://localhost:5173/
frontend_1 | ➜ Network: http://172.18.0.4:5173/
api_1 | app.js is running
api_1 | GET /accounts/session 200 5.323 ms - -
api_1 | GET /accounts/session 200 0.794 ms - -
api_1 | /app/node_modules/mongoose/lib/connection.js:788
api_1 | err = new ServerSelectionError();
api_1 | ^
api_1 |
api_1 | MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
api_1 | at _handleConnectionErrors (/app/node_modules/mongoose/lib/connection.js:788:11)
api_1 | at NativeConnection.openUri (/app/node_modules/mongoose/lib/connection.js:763:11) {
api_1 | reason: TopologyDescription {
api_1 | type: 'Unknown',
api_1 | servers: Map(1) {
api_1 | 'localhost:27017' => ServerDescription {
api_1 | address: 'localhost:27017',
api_1 | type: 'Unknown',
api_1 | hosts: [],
api_1 | passives: [],
api_1 | arbiters: [],
api_1 | tags: {},
api_1 | minWireVersion: 0,
api_1 | maxWireVersion: 0,
api_1 | roundTripTime: -1,
api_1 | lastUpdateTime: 550138,
api_1 | lastWriteDate: 0,
api_1 | error: MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
api_1 | at connectionFailureError (/app/node_modules/mongodb/lib/cmap/connect.js:367:20)
api_1 | at Socket.<anonymous> (/app/node_modules/mongodb/lib/cmap/connect.js:290:22)
api_1 | at Object.onceWrapper (node:events:629:26)
api_1 | at Socket.emit (node:events:514:28)
api_1 | at emitErrorNT (node:internal/streams/destroy:151:8)
api_1 | at emitErrorCloseNT (node:internal/streams/destroy:116:3)
api_1 | at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
api_1 | cause: Error: connect ECONNREFUSED 127.0.0.1:27017
api_1 | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
api_1 | errno: -111,
api_1 | code: 'ECONNREFUSED',
api_1 | syscall: 'connect',
api_1 | address: '127.0.0.1',
api_1 | port: 27017
api_1 | },
api_1 | [Symbol(errorLabels)]: Set(1) { 'ResetPool' }
api_1 | },
api_1 | topologyVersion: null,
api_1 | setName: null,
api_1 | setVersion: null,
api_1 | electionId: null,
api_1 | logicalSessionTimeoutMinutes: null,
api_1 | primary: null,
api_1 | me: null,
api_1 | '$clusterTime': null
api_1 | }
api_1 | },
api_1 | stale: false,
api_1 | compatible: true,
api_1 | heartbeatFrequencyMS: 10000,
api_1 | localThresholdMS: 15,
api_1 | setName: null,
api_1 | maxElectionId: null,
api_1 | maxSetVersion: null,
api_1 | commonWireVersion: 0,
api_1 | logicalSessionTimeoutMinutes: null
api_1 | },
api_1 | code: undefined
api_1 | }
api_1 |
api_1 | Node.js v20.5.1
api_1 | [nodemon] app crashed - waiting for file changes before starting...
@echo75 Since I know it's docker build I started to run it
It's important to make sure the at least have dummy .env files with localhast parameters in the folder.