fix(map): close live geolocation deployment drift - #7
Merged
Conversation
…a keyless bundle Reported from a real server deploy: pulled the repo, restarted, still no map. Two causes, and the first one is mine: 1. The repo-root .env.example advertised VITE_AMAP_JS_KEY, but Vite reads env files from apps/user-h5/ only (vite.config.ts: loadEnv(mode, appRoot)). Every other variable in this project lives in the root .env, so that is exactly where someone would put it — and it is silently ignored there. The example file now says plainly that it does not belong there and names the two places it does. 2. VITE_* is injected at BUILD time, so `git pull` plus a service restart cannot pick it up. The H5 must be rebuilt and dist/ redeployed. Now documented in an operations runbook. The build itself no longer stays quiet about it: a production build with no key prints a warning naming the file to set and the exact command to use. Previously it produced a bundle whose map could only ever say "not configured", with the symptom (no map on the server) appearing far from the cause (an env var in the wrong file). vite.config.ts also accepts process.env.VITE_AMAP_JS_KEY so CI and server builds can use `VITE_AMAP_JS_KEY=... pnpm build` without writing a file. Verified both directions: building without the key fires the warning and greps 0 occurrences out of dist/; building with it exported greps exactly 1. The key remains absent from git history and .env.local stays gitignored — confirmed with `git log --all -S`. That is deliberate per the AGENTS.md secrets baseline; it must be supplied on the server, not committed. Verification: ./scripts/verify.sh green — 293 backend tests, 13 Playwright specs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
scripts/check-deployment.shto detect stale map-service JARs, reverse-geocode failures, missing keys, and accidental Demo Provider fallbackbackend/pom.xmlclean-build/restart flow and the “map renders but current location fails” diagnosisAGENTS.mdwith the S45 live incident, fix, validation, and remaining runtime workLive verification
404for/api/maps/cities, while the checked-out source already contained the endpointactive,/api/maps/citiesreturned200, anddemoProvider=falseValidation
bash -n scripts/check-deployment.shgit diff --check./scripts/verify.sh: 293 backend tests; both frontend typechecks and production builds passedRemaining
demo-smoke.shregression on a sufficiently provisioned host