fix(lxlweb): don't crash in getHeldBy on missing org - #1649
Merged
Conversation
Member
Author
|
On closer inspection the 500s I saw were probably because |
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.
I noticed occasional 500 errors in prod:
The problem is that
getHeldByassumes that every org in a user'smyLibrarieshas a matching entry inorgs, but this is not necessarily true, asorgsis the result ofgetRefinedOrgs(libraries)which keeps only those for whichisLibraryOrgis true.This can happen if the user has favorited an org with no member libraries (if that's possible...?), or if the org (which is stored in a cookie) has been deleted or renamed, or possibly (at startup) due to a race condition if
refreshLibrarieshasn't finished.Anyway, for the unlucky visitor this results in virtually all search result pages and individual records simply crashing with a 500 error, until that cookie is cleared. So let's fix that.