Developer

Troubleshooting

Turn on App SDK diagnostics with a logger, read each log line, and fix common setup problems such as a blocked events host or an invalid publishable key.

Pass a logger to see what the SDK does. Without a logger the SDK writes nothing, not even to the console.

Turn on diagnostics

ts
await Apex.configure({
  publishableKey: 'apx_pk_live_…',
  shopId: 'YOUR_SHOP_ID',
  logger: (line) => console.debug(line),
});

In the tables below, … and 4xx stand for the values in the real line, such as a delay or an HTTP status. Log lines never contain the key, the Authorization header, response bodies or exception details. Each network failure type logs at most once per 60 seconds, so a long outage does not flood the log. An error in your logger function does not affect the SDK.

Setup and network

Log lineMeaning and fix
Apex configure: invalid options; SDK stoppedAn option is invalid, for example a key that does not start with apx_pk_ or a missing shop ID. Fix the options. The SDK does no storage or network work.
Apex SDK stopped: invalid_publishable_keyApex does not know the key, or it was revoked or expired. Create a new publishable key. Flag reads keep their last values.
Apex SDK stopped: publishable_key_not_allowedThe request used a route that does not accept publishable keys. Check that baseUrl is the Apex events host.
Apex assignment fetch failed: network error; retry scheduled in …The app could not reach Apex. On Cordova, check the content security policy. Also check the device connection.
Apex event delivery failed: network error; retry scheduled in …Events could not be sent. They stay in the queue and the SDK retries.
Apex assignment fetch failed: HTTP 503; retry scheduled in …Apex is temporarily unavailable. The SDK waits and retries.
Apex assignment fetch failed: HTTP 4xx; no retry scheduledApex rejected the request. Check shopId and environment.
Apex event delivery failed: HTTP 4xx; batch droppedApex rejected a batch. The SDK removes it from the queue.
Apex requires a browser or WebView; initialization skippedThe SDK ran without a DOM, for example during server-side rendering. Configure it again in the browser.
Apex initialization failedThe SDK could not start, for example because device storage failed.

The SDK sends the publishable key only as an Authorization: Bearer header and sends no cookies. Cookie authentication does not work from capacitor://localhost.

Storage

Log lineMeaning and fix
Apex identity storage unavailable; networking stoppedThe SDK could not read or write its device ID. Check your storage adapter.
Apex identity could not be saved; the SDK stopped networkingAn identify() write failed. The SDK keeps the previous identity and stops networking until a later identify() saves.
Apex could not persist eventsA queue write failed. The SDK keeps the previous queue.
Apex dropped purchase: queue write failedA purchase could not be saved. Call trackPurchase() again with the same order ID.
Apex could not load …A stored value could not be read. The SDK uses defaults.
Apex dropped event rows: queue capacityThe queue was full, so the SDK removed the oldest events.
Apex dropped expired or oversized event rowsEvents were older than the retention window, or a purchase was too large.

Flags

Log lineMeaning and fix
Apex typed flag 'key' unavailable or incompatible; using defaultThe flag has no assignment, or its value does not match your default type or validator. Check the flag key, its API delivery, and the value type.
Apex dropped exposure: session dedupe capacityOne session recorded more than 4,096 different exposures. New exposures are dropped until the next session.

Events

Log lineMeaning and fix
Apex dropped event: invalid event nameThe name is empty or longer than 256 characters.
Apex dropped event: property email is not allowedA property key is blocked as personal data. Remove it.
Apex dropped event: revenue must be a finite numberThe revenue property is not a valid number.
Apex ignored non-JSON event propertiesProperties must be a plain JSON object.
Apex dropped purchase: order_id must be a stringThe order ID is not a string, or it is longer than 1,024 characters.
Apex dropped purchase: order_id is requiredThe order ID is empty.
Apex dropped purchase: revenue must be a finite non-negative numberRevenue is negative, infinite or not a number.
Apex dropped purchase: currency must be a 3-letter ISO 4217 codeUse a code such as EUR or USD.
Apex dropped purchase: group exceeds queue capacity or the 200-event request limitThe purchase has more rows than the queue or one request can hold.

Other lines

Log lineMeaning and fix
Apex ignored invalid identity or attributesThe user ID is empty, too long or not a string. Use a non-empty string of up to 1,024 characters, or null.
Apex ignored invalid app statesetAppState() accepts only foreground or background.
Apex ignored invalid change handleronChange() needs a function.
Apex listener failedYour onChange handler threw an error. Other handlers still run.
Apex shell lifecycle listener unavailableThe Capacitor App listener could not be added. Forward lifecycle events yourself.

Common problems

Every request fails with a network error on Cordova. Add connect-src https://events.drip-apex.com to the content security policy.

Flags always return the default. Check that the flag is active and uses API delivery, that the key matches, and that the user matches the flag's targeting. Use the device lookup to see the device's exposures and events.

Screen URLs show app://unknown/home. The applicationId must contain only letters, digits, dots and hyphens, and must start and end with a letter or digit. Underscores are not allowed.

The app still runs the old SDK after you reinstall the same version. Clear Angular's .angular/cache folder and rebuild.

Results do not show test-build events. Test builds send QA traffic. Turn on the QA toggle in results.