fix(relay,desktop): surface CORS rejections and split invite mint/copy errors (#3636) - #4278
Open
iroiro147 wants to merge 1 commit into
Open
fix(relay,desktop): surface CORS rejections and split invite mint/copy errors (#3636)#4278iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
…y errors (block#3636) Two independent fixes for the same class: a misconfigured BUZZ_CORS_ORIGINS produces invisible failures costing self-hosters hours. Relay (router.rs): - Add warn! for every rejected CORS origin inside the existing AllowOrigin predicate. Before, a non-allowlisted origin was silently refused by the outer CORS layer and never reached the inner trace layer, so no log at any RUST_LOG level. Desktop (InviteLinkSection.tsx): - Split combined try around mintInvite + writeTextToClipboard into two error paths. Before, any mintInvite failure (CORS, NIP-98, 403, timeout, 5xx) surfaced as "Couldn't copy the invite link" — sending users to clipboard permissions instead of the real error. Mint failures now surface error.message; clipboard failures keep the old wording, distinguishing from mint failures since the minted invite (stored only as token_hash in relay_invites) is unrecoverable after a clipboard failure. Verified: - cargo check -p buzz-relay --lib clean - cargo clippy -p buzz-relay --lib zero warnings - cargo test -p buzz-relay --lib handlers::side_effects 5/5 - npx tsc --noEmit clean - Desktop webview tests: 3906/3906 pass Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
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.
Two independent fixes for the same failure class reported in #3636: a misconfigured
BUZZ_CORS_ORIGINSproduces invisible failures that cost self-hosters hours.Fix 1: warn-log rejected CORS origins (relay)
crates/buzz-relay/src/router.rsBefore, a non-allowlisted origin was silently refused by the outermost CORS layer and never reached the inner trace layer — no log line at any
RUST_LOGlevel. Now every rejected origin is logged atwarn!with the received origin value.Fix 2: split invite mint/copy error paths (desktop)
desktop/src/features/community-members/ui/InviteLinkSection.tsxBefore, the combined
tryaroundmintInvite+writeTextToClipboardcollapsed anymintInvitefailure (CORS, NIP-98 401/403, timeout, 5xx) into the misleading toast "Couldn't copy the invite link" — sending users to clipboard permissions instead of the actual network error. Mint failures now surface the underlyingerror.messagefrominvitePost; clipboard failures keep a distinct message, which matters because the minted invite (stored only astoken_hashinrelay_invites) is unrecoverable after a failed clipboard write.Fixes #3636.