Web SDK errors
TryYourSize.js throws (or emits with the loaderror event) a TryYourSizeError with a stable type and code, a message, and a docUrl that points at the matching section below.
| Type | Meaning |
|---|---|
integration_error |
Your code called the SDK wrongly. Thrown synchronously; fix the call. |
load_error |
Our window or script could not be loaded or reached: network, Content Security Policy, an origin not registered for the key. Emitted with loaderror, or a rejected promise. |
try { const tys = TryYourSize(window.TYS_KEY);} catch (e) { console.error(e.code, e.docUrl);}secret_key_in_browser
Section titled “secret_key_in_browser”You passed a secret key (sk_…) to TryYourSize(). Secret keys must never reach a browser: anyone could read them. Use your publishable key (pk_test_… / pk_live_…) and roll the secret key if it was deployed.
invalid_key
Section titled “invalid_key”The key is not a publishable key (pk_test_… or pk_live_… followed by at least 8 characters). Copy it again from Studio → Developers → API keys.
mount_not_found
Section titled “mount_not_found”element.mount(target) found nothing: the selector matched no element, or it ran before the element was in the page. Mount after the container exists (for example after DOMContentLoaded, or in your framework’s mounted hook).
already_mounted
Section titled “already_mounted”The element is already mounted. Call unmount() first, or create a second element (several of one type are allowed).
element_destroyed
Section titled “element_destroyed”The element was destroyed with destroy(). Create a new one with elements.create().
unknown_element_type
Section titled “unknown_element_type”elements.create(type) got a type that does not exist. Use "sizeGuide", "button" or "fit".
invalid_option
Section titled “invalid_option”An option is missing or invalid: product is required; variant must be "link" or "button"; label is a string of at most 60 characters; demo needs a test key and { body: "sample-female-165" }; recommendation() needs a product. The message names the option.
window_unreachable
Section titled “window_unreachable”Our window did not load or connect within 15 seconds. Emitted with loaderror. Check, in this order:
- Your Content Security Policy allows
frame-src https://embed.tryyoursize.com(andscript-src https://js.tryyoursize.comfor the CDN build). - The page’s origin is registered for the key’s mode in Studio (Settings → Stores → Allowed sites).
http://localhostworks in test mode without registering. - The network: an ad blocker or a corporate proxy blocking
tryyoursize.com.
See Troubleshooting.
script_load_failed
Section titled “script_load_failed”loadTryYourSize() could not load https://js.tryyoursize.com/v1/tys.js (network, CSP script-src). The promise rejects; call loadTryYourSize() again to retry.
Was this page helpful?
Thank you. We read every answer.