Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Developer troubleshooting

Common errors when embedding fastn, with their causes and fixes.

Blank embed / iframe renders nothing

Most likely cause: an expired or hardcoded token.

Embed tokens expire after 8 hours. If a token is hardcoded into your frontend or cached and reused, it works until it expires, then the iframe loads blank with no obvious error.

Fix: Generate a fresh token from your backend on each page load. Never hardcode or cache tokens. See Generating Embed Tokens.

Also check: In production, confirm FASTN_API_KEY is bound on the runtime, not just present in CI. An undefined API key means token generation fails silently. See Deployment.

404 on the token request

Most likely cause: the wrong customer identifier.

For x-org-id, or orgId in the body, use fastn's customer id, or the External ID shown on the customer (your own id if you set one when creating the customer; otherwise it defaults to the slug). An id that matches neither returns 404: IDENTITY_ORG_NOT_FOUND for x-org-id, Tenant not found for orgId. With a key limited to a single customer, only fastn's id works in orgId. See Generating Embed Tokens.

401 on the token request

Most likely cause: an API key set to Enforce under Verify caller identity (HMAC), called without signed identity headers.

Such a key refuses a token request that names the customer only in the body, or in x-org-id with no hash: 401 IDENTITY_HEADERS_REQUIRED when there are no identity headers, 401 IDENTITY_HMAC_INVALID when the hash is missing or wrong.

Fix: Send x-org-id, x-user-id and x-identity-hmac, computed with the key's identity secret. See Generating Embed Tokens.

Requests fail with a test key

Most likely cause: the missing test-mode header.

Requests made with a fsk_test_ key require the header X-fastn-Test-Mode: true. Without it, requests fail with 403 Test API keys require X-fastn-Test-Mode: true header.

Fix: Add X-fastn-Test-Mode: true for test keys. Remove it for live keys. See Authentication & API Keys.

"Failed to fetch" in the widget

Most likely cause: a tenancy or token mismatch.

This can appear when the iframe URL's tenancy shape doesn't match how the token was minted - for example, a single-tenant embed where the tenant-id and token identity don't line up.

Fix: Confirm the iframe URL matches your intended tenancy (see Tenancy), and that the token was generated with the correct x-org-id and identity fields. Confirm the backend token pattern is being used rather than a hardcoded token.

Empty response token

Most likely cause: reading the token from the wrong place in the response.

The token is nested under data in the response - response.data.token, not response.token.

Fix: Read json.data.token. See Generating Embed Tokens.

Last updated

Was this helpful?