-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Charon API endpoints don't respect global dataset-name redirections #858
Comments
The global dataset-name redirects nextstrain.org/src/redirects.js Lines 138 to 184 in fce8f83
are implemented via a nextstrain.org/src/redirects.js Lines 31 to 40 in fce8f83
and via the indexer nextstrain.org/resourceIndexer/coreUrlRemapping.js Lines 29 to 36 in fce8f83
which both make calls to nextstrain.org/src/redirects.js Lines 186 to 202 in fce8f83
Fixing Charon by continuing down those paths could include sprinkling more But stepping back, I think the more systematic and sustainable thing to do would be to make the dataset-rename redirections go thru the existing canonicalization layer that's currently used (solely) for default dataset handling (e.g. The indexer's nextstrain.org/resourceIndexer/coreUrlRemapping.js Lines 20 to 37 in fce8f83
(From an implementation perspective, I'd think ideally this would look like the indexer going thru |
Yeah, this would be clarifying (for the indexer as well).
Stepping back (me this time), maintaining two APIs (rest + charon) will always be susceptible to these kinds of bugs. We can change auspice to use the restful API, or change the server to rewrite charon calls into restful ones (not straightforward if you end up sending redirects down the line). Staying with two parallel APIs - even if they use a lot of the same methods - seems non ideal. As mentioned above, this bug has probably existed from the day global dataset-name redirects were added. |
Initial reporting by @huddlej in Slack; initial troubleshooting happened there and some brief in-person discussion.
By way of example:
https://nextstrain.org/flu/seasonal/h1n1pdm/ha/2y@2024-05-09 redirects to https://nextstrain.org/seasonal-flu/h1n1pdm/ha/2y@2024-05-09, but https://nextstrain.org/charon/getDataset?prefix=flu/seasonal/h1n1pdm/ha/2y@2024-05-09 responds with a 404 instead of a 302 redirection.
When a browser (or RESTful API client) directly requests the first URL, the redirection occurs and then Auspice (or the data) is served. Auspice then makes the request to the Charon API for the new name and everything is happy. Auspice never sees the old URLs.
However, when rendering a narrative, Auspice can see the old names, and requests to the Charon API with the old names can fail. In this particular example, the failure is because the old name is not in the resources index and so accessing a past snapshot by date does not work.
Remove the date and observe a secondary failure mode, however: the Charon API returns data but it's from 23 April 2024 instead of 9 May 2024, because it's sourcing the last update under the old name without respecting the dataset renames. This failure mode is more pernicious because it's a) not entirely obvious (success but increasingly out of date) and b) has existed for well-before snapshots/resource indexing existed.
The text was updated successfully, but these errors were encountered: