Troubleshooting
Authentication
| Symptom | Cause | Fix |
|---|---|---|
initScenid: client_id is required (also client_secret, token_uri) | The service key is incomplete or was parsed wrong | Re-download the key, check you pass the parsed object, not the file path |
oauth/token-request-failed: 401 oauth/invalid-client-secret | Wrong or outdated secret | Generate a new service key. Old keys stop working when a new one is generated |
oauth/token-request-failed: 400 oauth/invalid-client | Unknown client_id, or app deleted | Check the app still exists in Admin → Security |
403 oauth/public-client-not-allowed / oauth/grant-not-allowed | The app has no service key and is not confidential or lacks client_credentials | Generate a service key for the app |
403 oauth/service-key-not-provisioned | asUser used with an app without a service key | Generate a service key |
oauth/token-audience-mismatch | The ID token was issued to a different app | Sign in through this app's beginFlow |
oauth/tenant-mismatch | ID token from another tenant | Use the same tenant for login and app |
TypeError: Invalid URL on initScenid | Neither issuer nor cloud_stack in the key | Use the key exactly as downloaded |
auth/token-expired on verify | ID token older than its exp | Refresh with refreshFlow or sign in again |
Calls
| Symptom | Cause | Fix |
|---|---|---|
sdk: call initScenid() before using the SDK | sdk.asAdmin() before initScenid | Initialise at process start |
Response status: 401 with empty body | Token missing, expired or wrong token type for the endpoint | Use asAdmin or asUser correctly, see Concepts |
sdk/endpoint-invalid | A 404 with a non-JSON body: wrong host or path | Check the service key host (cloud_stack, issuer) |
sdk/fetch-failed | Network error | Check DNS and connectivity, run with DEBUG=scenid:sdk |
sdk/non-json-response | Proxy or gateway answered with HTML | Check the base URL and any proxy |
customers/missing-humanId | Entity.get('') | Pass a humanId |
customers/group-not-found | Group name in groups: [...] does not exist | Create the group first. Names are cached for 5 minutes |
insights/source-not-found | The source name does not exist for this tenant, or the cache is stale | Check spelling, wait a few seconds after creating a source |
sdk/aggregate-filter-must-be-array | filter passed as an object | Use an array of Elasticsearch clauses, see Query data |
Data problems
| Symptom | Cause | Fix |
|---|---|---|
400 { errors: [...] } on create | Validation failed | Read errors[].path and message |
Unexpected fields rejected on entity create | schema: 'minimal' was passed, restricting validation to the old create-only fields | Omit schema, or pass { strict: true } to see exactly which field is unknown |
Fields disappeared after OU/Person/Group update | overwrite: true was passed — it replaces data entirely instead of merging | Omit overwrite (merge is the default), or resend the full data if replace was intended |
| Employees or groups disappeared after update | employees, groups, employments are set-replaced | Send the complete list, or use upsertEmployee |
doc/body-not-flat | Nested object in an Insights document | Flatten the document |
doc/reserved-field:id | Body contains id or _id | Remove it. Ids are generated |
| Unknown Insights fields are gone | Fields not defined on the source are dropped | Add the field type to the source |
| Documents are duplicated on re-send, or overwritten unexpectedly | Duplicate control decides the document id (store default: random id, so every send is new. Field: same key updates) | Set duplicate control to a field (e.g. orderId) before the first data. See Sources |
Local development
ssl: falseandcloud_stack: "host:port"in the service key point the SDK to anhttplocal stack.- Use
DEBUG=scenid:*to see requests.DEBUG=scenid:sdk:verbosealso logs bodies. Tokens are never logged.
Still stuck?
Collect the failing call, the status and the result, the SDK version and the debug log (without secrets) and contact Scenid support.