fix(docker): authenticate the dev app's MongoDB URI (MITHOME-98)
docker-compose.dev.yml's mongodb service sets MONGO_INITDB_ROOT_USERNAME/ PASSWORD, which makes the official mongo image enable --auth — but the app service's MONGODB_URI was unauthenticated (mongodb://mongodb:27017/mozdit). Same bug class as MITHOME-32 (staging/production), but that ticket covers docker-compose.staging.yml /docker-compose.prod.yml specifically, not this dev file — hence the separate MITHOME-98. Why /api/health never caught it: that route is a pure liveness check and never touches MongoDB. Only an endpoint that actually performs a DB operation exercises the bug. Verified live (docker compose -f docker-compose.dev.yml up --build): - Reproduced the failure first: inside the running app container, a plain `mongodb://mongodb:27017/mozdit` connection's findOne() throws "Command find requires authentication" — confirms the hypothesis that the app fails only on a real query, not at startup. - With the fix in place: POST /api/contact returns 200 with a submissionId, and the document is actually present in contact_submissions (checked via mongosh) — a real, previously- broken write path now works end to end. - npm test: 58/58 passed (unaffected, as expected for a docker-compose/doc-only change). Also fixed the same stale unauthenticated example in DOCKER.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
018a1f2767
commit
4c54c639e5
@@ -56,7 +56,7 @@ mongosh "mongodb://admin:password123@localhost:27017/mozdit"
|
||||
### 3. Alkalmazásból
|
||||
Az alkalmazás automatikusan csatlakozik:
|
||||
```
|
||||
MONGODB_URI=mongodb://mongodb:27017/mozdit
|
||||
MONGODB_URI=mongodb://admin:password123@mongodb:27017/mozdit?authSource=admin
|
||||
```
|
||||
|
||||
## 🛠️ Fejlesztési Parancsok
|
||||
|
||||
Reference in New Issue
Block a user