Troubleshooting
init() throws immediately
The CDN bundle’s init() throws [1Sygnal] apiKey is required in init(). synchronously
(well, the function is async, so as a rejected Promise) if the API key is missing.
await oneSygnal.init(...) resolved immediately, but surveys aren’t showing
If you’re on the npm loader, init() returns void, not a Promise — awaiting it
doesn’t wait for anything. The bundle loads asynchronously in the background; there’s no
ready event on web to await instead (see Events). If you’re
loading the CDN bundle directly, its init() genuinely does return Promise<void>
that resolves once initialization completes — check you’re not accidentally mixing the two
distribution channels.
A call I made right after init() returned undefined
If you’re on the loader, calls made before the bundle finishes loading are queued and
their results are unobservable — there’s nothing yet to produce a return value.
on() returns undefined instead of a Registration; areSurveysEnabled() returns
undefined instead of a boolean. This is queuing behavior, not a bug — the call itself
(other than reads) still gets replayed against the bundle once it’s ready.
Script tag auto-init isn’t firing
src doesn’t contain the substring onesygnal. Auto-init only scans
<script data-api-key="..."> tags whose src matches that substring. Renaming or
proxying the script URL to something that doesn’t contain onesygnal breaks auto-init
with no console output.
Bundle failed to load
If the <script> tag’s request fails (network, blocked CDN, ad blocker), the loader logs
[1Sygnal] Failed to load SDK bundle from <url> to the console via console.warn and
resets its internal “bundle loaded” flag, so a later init() call will retry the
injection. Queued calls from before the failure remain queued.