Errors and fixes
5. Errors and fixes
Signer errors are also logged with console.error in the host page as nostr-bridge: signer error CODE: message, followed by a hint. Non-fatal problems are logged with console.warn as nostr-bridge: signer warning CODE: message.
In the errors below that turn off Google/Apple/X sign-in, an extension or bunker still works through the Sign in button.
| Code / message | Cause | Fix |
|---|---|---|
CLIENT_ID_NOT_FOUND | Web3Auth has no Sapphire Mainnet project with this clientId | Copy the right client ID, or leave clientId out for shared sign-in |
DOMAIN_NOT_REGISTERED | The origin is neither in the NIP-33 registry nor in the Web3Auth allowlist | Register the exact origin (scheme + host + port) in the portal, or add it to the Web3Auth Allowlist URLs. The registry lookup is cached per browser tab, so test in a new tab |
NESTED_FRAME | The page using the signer is itself inside another site's frame; that site could hide or cover the signer's prompts | Open the app in its own tab (top-level window) |
NO_SIGN_IN_METHOD | No Google/Apple/X for the page (nostrOnly, or a signer without shared sign-in), and window.nostr.js failed to load or forceIframe skipped it | Check that cdn.jsdelivr.net is reachable, or pass a clientId |
NOT_IN_REGISTRY (warning) | The origin is allowlisted in Web3Auth but not registered in the portal | Register it in the portal so sign-in keeps working when the allowlist can't be read |
SHARED_BLOCKED (warning) | The hosted signer's operator blocked this site from shared sign-in; extension and bunker sign-in still work | Pass your own Web3Auth clientId for Google/Apple/X |
NOT_ALLOWLISTED (warning) | The origin is registered in the portal but not in the Web3Auth allowlist | Add it to the Web3Auth Allowlist URLs |
WEB3AUTH_INIT_FAILED | Wrong clientId, or the signer origin is not allowlisted | Check the clientId; add https://signer.shardsigner.com to the Web3Auth Allowlist URLs |
MISSING_ROOT_PUBKEY | The signer was built without a registry root key, and the origin isn't in the Web3Auth allowlist | Omit bunkerOrigin to use the hosted signer; if self-hosting, build it with VITE_ROOT_PUBKEY_HEX |
NOT_EMBEDDED | signer.html was opened directly, or (Firefox) the page that embeds it didn't confirm it: a copied or pinned nostr-bridge.js from before that check | Only load it through nostr-bridge.js, from <bunkerOrigin>/nostr-bridge.js or the npm package's loadNostrBridge() |
PROTOCOL_UNSUPPORTED | nostr-bridge.js and the signer at bunkerOrigin are different versions (e.g. a copied or CDN-pinned bridge with a newer or self-hosted signer) | Load nostr-bridge.js from <bunkerOrigin>/nostr-bridge.js, or use the npm package's loadNostrBridge(), which does that |
LOGIN_FAILED | The OAuth login failed (not cancelled) | Usually transient; the user can retry |
KEY_EXPORT_OFF | The page's own Web3Auth project has key export turned off, so it can't give Nostr keys | Turn key export on in the Web3Auth dashboard, or leave clientId out for shared sign-in |
SHARED_SIGN_IN_PAUSED | Shared sign-in only: the hosted signer's shared Web3Auth project changed unexpectedly (a site added to its allowlist, or key export off), so the signer starts no new shared sign-in. Users already signed in keep working | Nothing to fix on the page; the operator is alerted. Pass your own clientId to avoid depending on the shared project |
| "nostr-bridge: no clientId, so Google/Apple/X sign-in goes through the signer's shared project…" (info) | init() without clientId | Expected: shared sign-in. Pass a clientId for keys of your own project, or nostrOnly: true to turn it off |
| "nostr-bridge: no clientId, so Google/Apple/X sign-in is off…" (warning) | init() without clientId, with a self-hosted signer that has no shared sign-in | Pass a clientId to add Google/Apple/X, or nostrOnly: true if that's intended |
| "nostr-bridge: bunkerOrigin must be an absolute URL…" | Bad bunkerOrigin | Omit it, or pass a full https URL |
| "nostr-bridge: user is not logged in…" | Call made before sign-in | Wait for onAuthChange with loggedIn: true, or call NostrBridge.login() from a button |
| "nostr-bridge: RPC timeout…" | No answer from the signer within 30 s | The signer iframe is stuck or was removed; reload |
| "User rejected" | The user clicked Reject on the confirmation | Don't retry automatically |
| "Refused: the event is for another identity" | signEvent with a pubkey that isn't the active identity (the user switched identities on this site) | Leave pubkey empty, or use the one from onAuthChange |
| "Refused: the event is dated in the future" | created_at more than 5 minutes ahead | Use the current time |
| "Refused: the signer never deletes its own records or vaults for a site" | A kind-5 deletion aimed at an Evolustr vault or at another key's address | Don't delete those |
| "nostr-bridge: already initialized …" (warning) | init() called again with a different clientId | The first config stays in effect; reload the page to switch |
6. Don'ts
- Don't import or bundle
nostr-bridge.jsitself. Load it with the script tag above, or withloadNostrBridge()from thenostr-shard-signernpm package, which loads that same script. - Don't assign
window.nostryourself afterinit(). The bridge keeps its own object there. - Don't ask the user for their nsec or build a key-import UI. Users who have a key use an extension or a bunker through the widget.
- Don't expect npub values. Pubkeys are hex. Use nostr-tools
nip19.npubEncodefor display. - Don't expect the bridge to publish events or talk to relays for the app.
- Don't hide or cover the widget container
#nostr-signer-container. The sign-in modal and signing confirmations open in it, also afterNostrBridge.login().