Troubleshooting
The handful of things that go wrong, and what they mean.
[coverport] \key` must be a publishable key`
Thrown synchronously by mount() or open(). The value you passed does not match pk_live_… or pk_test_…. Usually the environment variable is missing in that build, or a secret key was pasted by mistake. Never put a secret key in a browser.
[coverport] mount target not found: #insure-btn
mount() was called before the element existed. Call it after the DOM is ready, or in your framework's mounted hook. The script-tag build waits for DOMContentLoaded automatically.
The modal opens but says the key is not valid
The key format is right but CoverPort does not recognise it. Check that the key exists in the developer portal, is not frozen or deleted, and that you are not using a test key from one account with the live flow of another.
The modal says the key has no allowed origins
The key has no Allowed origins. Every key, test or live, only works on the sites listed on the key, so CoverPort refuses it everywhere until you add your site's origin (for example https://www.example.com) in the developer portal. See Keys.
The modal is empty or shows a browser error page
If the browser console says the frame was refused because of frame-ancestors, your page's origin is not in the key's Allowed origins. Add it exactly: scheme, host and port.
Otherwise your Content Security Policy is blocking the frame. Add https://embed.coverport.io to frame-src (or child-src). If you use the script tag, https://unpkg.com must be in script-src.
onComplete never fires
- Check that the page's origin is in the key's Allowed origins. The flow only posts
completeto a listed origin. - Check the browser console for a
postMessageorigin warning. The flow posts to thehostorigin the SDK passed; if your page is served from a different origin thanwindow.location.originreported at open time (for example behind a proxy that rewrites hosts), the message is dropped. - Make sure nothing on your page removes
#coverport-overlaybefore the buyer finishes. The listener is torn down with the overlay.
The button looks wrong
The SDK's .cp-button styles are minimal on purpose. Either override the class in your stylesheet or put your own markup inside the mount target and the SDK will not render a button at all.
Two modals, or the modal reopens
open() replaces any existing modal. If you see two, you have two copies of the SDK on the page, usually one from npm and one from a script tag. Pick one.
Still stuck
Email api-support@coverport.io with your publishable key, the page URL, and the browser console output.