fix(api): /pwa_listing 500'd on non-JSON 200 manifest bodies — now NO_PWA (3.16.2) - #684
Open
jacoby149 wants to merge 6 commits into
Open
fix(api): /pwa_listing 500'd on non-JSON 200 manifest bodies — now NO_PWA (3.16.2)#684jacoby149 wants to merge 6 commits into
jacoby149 wants to merge 6 commits into
Conversation
…_PWA (3.16.2) A registered file URL (.../index.html) makes the manifest lookup hit <file>/manifest.json, which the SPA fallback answers with HTML + 200. json.loads raised JSONDecodeError (a ValueError, not a RequestException) which the except clause never caught. Now: NO_PWA + [pwa_listing] log, and the Accept header actually goes in headers= (was a query param).
…json-decode-error
…rsion collision with the discover-group 3.16.2)
…json-decode-error
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.
What
The dev store 500'd with
JSONDecodeError: Expecting value: line 1 column 1 (char 0)onGET /pwa_listing?url=https://dev.web10.app/docs/media/index.html.Root cause
The registered app URL is a file (
.../index.html), so the manifest lookup hits.../index.html/manifest.json— the static server's SPA fallback answers that with HTML + 200.json.loads()raisedJSONDecodeError(aValueError, not aRequestException), which the endpoint'sexcept requests.exceptions.RequestExceptionnever caught → 500.The designed behavior (D47): no manifest → NO_PWA (401) → the store falls back to the registered name, then the host.
Fix
json.JSONDecodeError+UnicodeDecodeError→NO_PWA, with a[pwa_listing]log line at each NO_PWA decision point.requests.get(url, {"Accept": ...})passed the header dict as the params positional — the Accept header was going out as a query string. Nowheaders=.Notes
The deeper data issue is left alone (a D47 identity call, not a bug): the media demo is registered under its
index.htmlfile URL on dev, and a file URL can never have a manifest at{url}/manifest.json— the store now degrades gracefully instead of 500ing.715 API tests green.