Repository navigation
Say what is wrong when db:up cannot reach Docker - #11
Merged
Merged
Conversation
pm run db:up was docker compose up -d, so when Docker is not running the user gets Docker's own message: unable to get image 'mongo:8': error during connect: Get "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/v1.51/images/mongo:8/json": open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file specified. A named pipe, a URL-encoded path and an API version, and nowhere does it say "start Docker Desktop". For a library whose argument is that a failure should explain itself, passing that through unedited was a poor showing. scripts/db.js now checks the two things that actually go wrong before handing over to compose - Docker missing, and the daemon down - and reads the compose output for the third, which is the common one once Docker IS running: port 27017 already held by another project's container. Each case says what to do, and all three mention the Atlas escape hatch. Plain JavaScript, because it runs before anything is built, and no new dependency. All three paths tested against real conditions: docker removed from PATH, DOCKER_HOST pointed at a dead pipe, and a second container holding 27017.
A scaffolded project promised interactive API docs and did not ship the package that serves them, so the docs URL answered "Cannot GET". setupSwagger treats swagger-ui-express as an optional peer: absent, it warns, skips the browser UI and serves the spec at the json path alone. That is correct behaviour for the library. The template was the problem - it asserted the URL in four places while listing no dependency: src/banner.ts printed the docs URL on EVERY boot README.md "Interactive docs: ..." ai/skills/parse-boot.md ai/skills/parse-endpoint.md told an assistant to go and check it The banner is the worst of the four, because it points at the dead URL every time the server starts. Worth contrasting with the dashboard, which is also optional and handled properly: it is opt-in on purpose - it carries the master key, which is a real security decision - and banner.ts has a dashboardLine() reporting when it is not mounted. Swagger has no such concern. Documentation for your own API should work when the project starts, so the dependency is now declared rather than the promise withdrawn. Verified in a fresh project: swagger-ui-express installs, the project compiles, and its five tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pm run db:up was docker compose up -d, so when Docker is not running the user gets Docker's own message:
unable to get image 'mongo:8': error during connect: Get
"http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/v1.51/images/mongo:8/json":
open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file
specified.
A named pipe, a URL-encoded path and an API version, and nowhere does it say "start Docker Desktop". For a library whose argument is that a failure should explain itself, passing that through unedited was a poor showing.
scripts/db.js now checks the two things that actually go wrong before handing over to compose - Docker missing, and the daemon down - and reads the compose output for the third, which is the common one once Docker IS running: port 27017 already held by another project's container. Each case says what to do, and all three mention the Atlas escape hatch.
Plain JavaScript, because it runs before anything is built, and no new dependency.
All three paths tested against real conditions: docker removed from PATH, DOCKER_HOST pointed at a dead pipe, and a second container holding 27017.