fix: Nominatim location sync — User-Agent policy + diagnostic logging#1966
Open
Asi0Flammeus wants to merge 1 commit intodevfrom
Open
fix: Nominatim location sync — User-Agent policy + diagnostic logging#1966Asi0Flammeus wants to merge 1 commit intodevfrom
Asi0Flammeus wants to merge 1 commit intodevfrom
Conversation
Collaborator
|
Does this works locally on your computer @Asi0Flammeus ? Plz run it locally, and fix the issue. |
Root cause: Nominatim returns HTML on 429 rate limit, causing res.json() to crash with SyntaxError. Requests fired in a tight loop with no delay. - Add 1.1s delay between requests (Nominatim policy: max 1 req/s) - Add User-Agent header (required by Nominatim usage policy) - Check res.ok before parsing response to avoid crash on errors - Remove debug console.log from fetch functions Tested locally: 186 event + 21 project locations resolved, zero 429s. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29e90f1 to
dbc90fb
Compare
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.
Problem
Event/project location sync fails silently for new locations. The
.catch(() => null)swallowed all errors, making diagnosis impossible.Root cause identified: Nominatim returns HTTP 429 (rate limit) with an HTML error page instead of JSON. The code calls
res.json()on this HTML, crashing withSyntaxError: Unexpected token '<'. This happens because requests were fired in a tight loop with no delay, violating Nominatim's 1 req/s policy.Solution
res.ok) — throws a clear error on non-200 responses instead of crashing on HTML parsingTested locally
Ran a full content sync against the public Nominatim API with the fix applied: