Observability
For: an operator who watches an API with authtempo in production.
What it does: this guide sends the events of core to a sink, reads the trace of one request, and sets the alerts. It also lists each default line.
Before you start
Section titled “Before you start”- An API that runs. Deploy puts it on Workers, on Node, or on Bun.
- The event list. Events gives the level and the fields of each event.
Pick a sink
Section titled “Pick a sink”With no observe config, core writes each default line with console, and nothing leaves the app. With a sink, core writes no console line, and the sink gets each event, with one exception. Core writes secret.low_entropy with console while createAuth reads the config, and no sink gets it. A sink has one call, write(batch). The package @authtempo/observe has three sinks:
| Sink | Where the events go | Use it for |
|---|---|---|
workersLogsSink |
One console call of one object for each event, in Workers Logs |
The default on Workers. Each field is indexed. |
analyticsEngineSink |
One data point for each event of a chosen list | Counts over time, read with SQL. |
otlpSink |
OTLP logs, traces, and metrics over HTTP | A collector of the app, off Workers too. |
An app can write its own sink. It gets the events after the answer, and it owns what it does with them.
- Set the observability block in
wrangler.jsonc:enabledistrue, andhead_sampling_rateis1. A lower rate drops whole requests, and with them their sign-in events. A site test fails when an example config loses either value.
{ "$schema": "node_modules/wrangler/config-schema.json", "name": "my-app", "main": "src/index.ts", "compatibility_date": "2026-09-30", // From compatibility date 2026-08-04 Workers turn nodejs_compat on by // default. Core and the D1 adapter use no Node.js API, so these two flags // turn it off. The test bundles the Worker and fails on any node: import. "compatibility_flags": ["no_nodejs_compat", "no_nodejs_compat_v2"], "vars": { // The origin of this Worker. Change it to your own origin before a deploy. "BASE_URL": "https://example.test" }, "d1_databases": [ { "binding": "DB", "database_name": "my-app", // Replace this with the id that `wrangler d1 create my-app` prints. // The test runs on a local database and needs no real id. "database_id": "00000000-0000-0000-0000-000000000000", // The adapter package ships the migrations. wrangler reads this path // relative to this file. "migrations_dir": "node_modules/@authtempo/adapter-d1/migrations" } ], // Workers Logs keeps the events of the Workers Logs sink of // @authtempo/observe (plan 12h). A default is not a promise, so this block // states it. Read 2026-10-14 at developers.cloudflare.com/workers/ // observability/logs/workers-logs/: Free 200,000 log events a day and 3 days // of retention; Paid 20 million a month, then $0.60 a million, and 7 days; // from 2026-12-01 Workers Logs moves to Cloudflare Observability pricing. "observability": { "enabled": true, // 1 keeps every request. A rate below 1 drops whole requests, and with // them the sign-in events of those requests (OWASP ASVS 5.0.0 16.3.1). // Lower it only with the OTLP sink as the record of security events. "head_sampling_rate": 1 }, // The sweep deletes expired links, codes, and sessions. Without a trigger // they stay in D1 forever. "triggers": { "crons": ["17 * * * *"] } // AUTH_SECRET is a secret: `wrangler secret put AUTH_SECRET`. The test sets // it in vitest.config.ts.}- Give
observea sink, and pass{ waitUntil: (p) => ctx.waitUntil(p) }tohandle. Bind it: an unboundctx.waitUntilthrows. Make theAuth, and with it the sink, once for each isolate.
import { createD1Adapter, createD1Limiter } from "@authtempo/adapter-d1";import { type Auth, type AuthConfig, createAuth, type HooksConfig, type MailPort,} from "@authtempo/core";import { workersLogsSink } from "@authtempo/observe/workers-logs";
/** The bindings and vars of wrangler.jsonc, and the secret of `wrangler secret put AUTH_SECRET`. */export interface Env { DB: D1Database; BASE_URL: string; AUTH_SECRET: string;}
/** * Your mail transport. Core calls `send` once per mail: a magic link, an * email code, a reset link. Replace the body with a call to your mail * provider. Until then a sign-in request answers 500, so a deploy with no * mail fails at once and not in silence. */export const mail: MailPort = { async send() { throw new Error("my-app: no mail transport; replace mail.send in src/index.ts"); },};
/** * The Worker. The test passes a mail port that keeps the mails, and hooks of its own. * `more` adds config keys for one env, after the keys below. The measure entry * (src/measure.ts) adds the password config and its own sink with it. */export function createWorker( mailPort: MailPort, hooks?: HooksConfig, more?: (env: Env) => Partial<AuthConfig>,) { // One auth instance per isolate. The bindings stay the same for the life of the isolate. let auth: Auth | null = null; const getAuth = (env: Env): Auth => (auth ??= createAuth({ baseURL: env.BASE_URL, secret: env.AUTH_SECRET, trustedOrigins: [env.BASE_URL], storage: createD1Adapter(env.DB), // The owned limiter counts in D1, so every isolate shares one count. // The default limiter counts per isolate, and is for tests only. limiter: createD1Limiter(env.DB), mail: mailPort, ...(hooks ? { hooks } : {}), // Each event of core goes to Workers Logs as one JSON object. wrangler.jsonc // turns the logs on. With a sink, core writes no console line of its own. // The sink scrubs the secret of the config from each field, as the last guard. observe: { sink: workersLogsSink({ secrets: [env.AUTH_SECRET] }) }, ...(more ? more(env) : {}), }));
return { async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> { const url = new URL(request.url); const a = getAuth(env); const viaHandle = url.pathname.startsWith("/auth/"); try { // The events flush after the answer. Bound on purpose: an unbound // ctx.waitUntil throws Illegal invocation (Cloudflare Workers best // practices, read 2026-10-14). if (viaHandle) return await a.handle(request, { waitUntil: (p) => ctx.waitUntil(p) }); if (url.pathname === "/me") { const s = await a.session(request); if (!s) return Response.json({ error: "unauthorized" }, { status: 401 }); const res = Response.json({ email: s.user.email }); // A sliding refresh moved the expiry: renew the cookie, or the browser drops it early. const renewed = a.sessionCookie(request, s); if (renewed) res.headers.append("set-cookie", renewed); return res; } return new Response("not found", { status: 404 }); } finally { // handle flushes its own events. A call outside it, such as the session // read of /me, flushes here, or its events wait for the next handle call. if (!viaHandle) ctx.waitUntil(a.observe.flush()); } }, // The cron trigger of wrangler.jsonc runs this. It deletes the rows that no flow can use. async scheduled( _controller: ScheduledController, env: Env, ctx: ExecutionContext, ): Promise<void> { ctx.waitUntil(getAuth(env).api.sweepExpired()); }, } satisfies ExportedHandler<Env>;}
export default createWorker(mail);- For counts, bind an Analytics Engine dataset, and give its binding to
analyticsEngineSink.
"analytics_engine_datasets": [{ "binding": "AUTH_EVENTS", "dataset": "authtempo_events" }]import { type Auth, createAuth, type MailPort, type StorageAdapter } from "@authtempo/core";import { type AnalyticsEngineDatasetLike, analyticsEngineSink,} from "@authtempo/observe/analytics-engine";
/** The binding of `analytics_engine_datasets` in wrangler.jsonc, and the app secret. */export interface EventsEnv { AUTH_EVENTS: AnalyticsEngineDatasetLike; AUTH_SECRET: string;}
/** * An Auth that writes one data point for each request, sign-in, second * factor challenge, limit hit, sweep, and lost batch. Make it once for * each isolate. */export function authWithAnalytics( env: EventsEnv, deps: { storage: StorageAdapter; mail: MailPort },): Auth { return createAuth({ baseURL: "https://api.example.com", trustedOrigins: ["https://app.example.com"], secret: env.AUTH_SECRET, storage: deps.storage, mail: deps.mail, // The secret list is the last guard: the sink replaces each value with *** in each blob. observe: { sink: analyticsEngineSink(env.AUTH_EVENTS, { secrets: [env.AUTH_SECRET] }) }, });}- Read the counts with SQL. Analytics Engine samples on write, so count with
SUM(_sample_interval), neverCOUNT().
-- Analytics Engine samples on write. Each row counts for _sample_interval-- events, so a count is SUM(_sample_interval), never COUNT().-- The blobs: blob1 name, blob2 route, blob3 outcome, blob4 code,-- blob5 method, blob6 provider, blob7 family, blob8 traceId.
-- The password sign-ins that failed in the last hour.SELECT SUM(_sample_interval) AS failuresFROM authtempo_eventsWHERE index1 = 'sign_in' AND blob5 = 'password' AND blob3 = 'failure' AND timestamp > NOW() - INTERVAL '1' HOUR;
-- The limit hits of each family, for each day of the last week.SELECT toStartOfDay(timestamp) AS day, blob7 AS family, SUM(_sample_interval) AS hitsFROM authtempo_eventsWHERE index1 = 'limit.hit' AND timestamp > NOW() - INTERVAL '7' DAYGROUP BY day, familyORDER BY day, hits DESC;
-- The answers of each route by outcome in the last hour.SELECT blob2 AS route, blob3 AS outcome, SUM(_sample_interval) AS answersFROM authtempo_eventsWHERE index1 = 'request' AND timestamp > NOW() - INTERVAL '1' HOURGROUP BY route, outcomeORDER BY answers DESC;- For a collector, give
otlpSinkthe base URL and the headers of the collector. GivetimeoutMsthe value ofobserve.flushTimeoutMs, so no post outlives its flush. Each one takes an integer from 100 to 10000.
import { type Auth, createAuth, type MailPort, type StorageAdapter } from "@authtempo/core";import { otlpSink } from "@authtempo/observe/otlp";
/** The collector of the app: its base URL and its token, both secrets of the host. */export interface CollectorEnv { OTLP_ENDPOINT: string; OTLP_TOKEN: string; AUTH_SECRET: string;}
/** The time that core waits for one flush. Each post of the sink aborts at the same time. */const FLUSH_TIMEOUT_MS = 2000;
/** * An Auth that posts its logs, traces, and metrics to an OTLP collector. * Make it once for each isolate, so each isolate writes one metric stream. */export function authWithCollector( env: CollectorEnv, deps: { storage: StorageAdapter; mail: MailPort; fetch?: typeof fetch },): Auth { const sink = otlpSink({ endpoint: env.OTLP_ENDPOINT, serviceName: "auth", headers: { authorization: `Bearer ${env.OTLP_TOKEN}` }, // The sink adds each header value to this list itself. secrets: [env.AUTH_SECRET], timeoutMs: FLUSH_TIMEOUT_MS, ...(deps.fetch ? { fetch: deps.fetch } : {}), }); return createAuth({ baseURL: "https://api.example.com", trustedOrigins: ["https://app.example.com"], secret: env.AUTH_SECRET, storage: deps.storage, mail: deps.mail, observe: { sink, flushTimeoutMs: FLUSH_TIMEOUT_MS }, });}- On Node and on Bun,
handlehas nowaitUntil. Flush the buffer on a timer, and flush once more at shutdown.
import type { Auth } from "@authtempo/core";
/** * Node and Bun have no `waitUntil`, so a timer flushes the buffer. Call * the answer at shutdown: it stops the timer and sends the last batch. */export function startFlush(auth: Auth, everyMs = 5000): () => Promise<void> { const timer = setInterval(() => void auth.observe.flush(), everyMs); return async () => { clearInterval(timer); await auth.observe.flush(); };}- In a scheduled handler, call
api.sweepExpired(). It flushes at its end, so thesweepevent needs no other call. - Set the alerts. Alert on each event of level
error, on a rise oflimit.hit, and onobserve.droppedabove 0. - For a push alert on Workers, add a Tail Worker. It gets the logs of the API Worker and posts each error event. In the
wrangler.jsoncof the API Worker, name the Tail Worker intail_consumers. Without it, the Tail Worker gets no log.
"tail_consumers": [{ "service": "authtempo-alerts" }]/** One log of a Worker, as a Tail Worker gets it. The Workers Logs sink writes one event per log. */interface TailItem { logs: { message: unknown[] }[];}
/** The events of level error in the logs of the tailed Worker. */export function errorEvents(items: readonly TailItem[]): unknown[] { return items .flatMap((item) => item.logs.map((log) => log.message[0])) .filter((m) => typeof m === "object" && m !== null && Reflect.get(m, "level") === "error");}
export default { // Posts each error event to the alert URL of the app, such as a chat webhook. async tail(items: TailItem[], env: { ALERT_URL: string }): Promise<void> { const errors = errorEvents(items); if (errors.length > 0) await fetch(env.ALERT_URL, { method: "POST", body: JSON.stringify(errors) }); },};The tests below run the samples. The test of the D1 example checks that its fetch passes waitUntil to handle.
import { afterEach, describe, expect, it, vi } from "vitest";import { harness, SECRET, signIn } from "../support/harness.ts";import { authWithAnalytics } from "./observe-analytics-engine.ts";import { startFlush } from "./observe-node-flush.ts";import { authWithCollector } from "./observe-otlp.ts";import tail, { errorEvents } from "./tail-worker.ts";
type Point = { indexes?: string[]; blobs?: (string | null)[]; doubles?: number[] };
/** A fetch that keeps the path and the body of each post, and answers 200. */function collector() { const posts: { path: string; body: string }[] = []; const fetcher = (async (input: RequestInfo | URL, init?: RequestInit) => { posts.push({ path: new URL(String(input)).pathname, body: String(init?.body ?? "") }); return new Response(null, { status: 200 }); }) as typeof fetch; return { posts, fetcher };}
const COLLECTOR_ENV = { OTLP_ENDPOINT: "https://otlp.example.com", OTLP_TOKEN: "collector-token-0123456789", AUTH_SECRET: SECRET,};
// The two Auth builders take the env of the host first. Their names do not// start with create, because constructs.test.ts calls each create…Auth with the// harness alone. The tests below construct both with real values.describe("the observability samples", () => { afterEach(() => { vi.useRealTimers(); vi.unstubAllGlobals(); });
it("writes a data point for the sign-in, with the event name as the index and no secret", async () => { const points: Point[] = []; const h = harness(); const auth = authWithAnalytics( { AUTH_EVENTS: { writeDataPoint: (p) => void points.push(p) }, AUTH_SECRET: SECRET }, h, ); await signIn(auth, h, "ada@example.com"); await auth.observe.flush(); const signIns = points.filter((p) => p.indexes?.[0] === "sign_in"); expect(signIns.map((p) => [p.blobs?.[2], p.blobs?.[4]])).toEqual([["success", "magic_link"]]); expect(points.some((p) => p.indexes?.[0] === "request")).toBe(true); expect(JSON.stringify(points)).not.toContain(SECRET); });
it("posts the logs, the traces, and the metrics once for each flush, with no secret in a body", async () => { const { posts, fetcher } = collector(); const h = harness(); const auth = authWithCollector(COLLECTOR_ENV, { ...h, fetch: fetcher }); await signIn(auth, h, "ada@example.com"); await auth.observe.flush(); expect(posts.map((p) => p.path).sort()).toEqual(["/v1/logs", "/v1/metrics", "/v1/traces"]); for (const p of posts) { expect(p.body).not.toContain(SECRET); expect(p.body).not.toContain(COLLECTOR_ENV.OTLP_TOKEN); } });
it("flushes on a timer, and sends the last batch at the stop", async () => { vi.useFakeTimers({ toFake: ["setInterval", "clearInterval"] }); const { posts, fetcher } = collector(); const h = harness(); const auth = authWithCollector(COLLECTOR_ENV, { ...h, fetch: fetcher }); const stop = startFlush(auth, 5000); await signIn(auth, h, "ada@example.com"); expect(posts).toEqual([]); await vi.advanceTimersByTimeAsync(5000); expect(posts.filter((p) => p.path === "/v1/logs")).toHaveLength(1); await signIn(auth, h, "bob@example.com"); await stop(); expect(posts.filter((p) => p.path === "/v1/logs")).toHaveLength(2); await vi.advanceTimersByTimeAsync(10_000); expect(posts.filter((p) => p.path === "/v1/logs")).toHaveLength(2); });
it("posts only the error events of the tailed logs", async () => { const error = { name: "error.internal", level: "error" }; const items = [ { logs: [{ message: [{ name: "request", level: "info" }] }, { message: [error] }] }, { logs: [{ message: ["a text line"] }, { message: [null] }] }, ]; expect(errorEvents(items)).toEqual([error]); const posted: string[] = []; vi.stubGlobal("fetch", async (_url: string, init: RequestInit) => { posted.push(String(init.body)); return new Response(null, { status: 204 }); }); await tail.tail(items, { ALERT_URL: "https://alerts.example.com/hook" }); await tail.tail([{ logs: [{ message: [{ level: "info" }] }] }], { ALERT_URL: "https://alerts.example.com/hook", }); expect(posted).toEqual([JSON.stringify([error])]); });});import { env } from "cloudflare:test";import type { MailMessage } from "@authtempo/core";import { afterEach, describe, expect, it, vi } from "vitest";import { createWorker } from "../src/index";
const BASE = "https://example.test";const json = (path: string, body: unknown) => new Request(`${BASE}${path}`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body), });
/** A context whose waitUntil is a spy. `settle` awaits each promise that the Worker gave it. */function spyContext() { const held: Promise<unknown>[] = []; const waitUntil = vi.fn((p: Promise<unknown>) => void held.push(p)); const ctx = { waitUntil, passThroughOnException() {}, props: {} } as unknown as ExecutionContext; return { ctx, waitUntil, settle: () => Promise.all(held) };}
afterEach(() => { vi.restoreAllMocks();});
describe("the flush of the D1 Worker (plan 12h ruling 13)", () => { it("passes waitUntil once to handle for GET /auth/health", async () => { const { ctx, waitUntil, settle } = spyContext(); const res = await createWorker({ async send() {} }).fetch( new Request(`${BASE}/auth/health`), env, ctx, ); expect(res.status).toBe(200); expect(waitUntil).toHaveBeenCalledTimes(1); await expect(settle()).resolves.toEqual([undefined]); });
it("flushes the fault of a session read on /me in the same request", async () => { const sent: MailMessage[] = []; const app = createWorker( { async send(m) { sent.push(m); }, }, { session: { afterEnd() { throw new RangeError("the tenant store is down"); }, }, }, ); const email = "observe-flush@example.com"; await app.fetch(json("/auth/magic-link/request", { email }), env, spyContext().ctx); const link = /https:\/\/\S+/.exec(sent.at(-1)?.text ?? "")?.[0] ?? ""; const token = new URL(link).searchParams.get("token") ?? ""; const verify = await app.fetch( json("/auth/magic-link/verify", { token }), env, spyContext().ctx, ); expect(verify.status).toBe(200); const cookie = (verify.headers.get("set-cookie") ?? "").split(";")[0] ?? ""; // The session expires, as it does when its time passes. const ended = await env.DB.prepare( "UPDATE ta_session SET expires_at = 1 WHERE user_id = (SELECT id FROM ta_user WHERE email = ?)", ) .bind(email) .run(); expect(ended.meta.changes).toBe(1);
const error = vi.spyOn(console, "error").mockImplementation(() => {}); const { ctx, waitUntil, settle } = spyContext(); const me = await app.fetch(new Request(`${BASE}/me`, { headers: { cookie } }), env, ctx); expect(me.status).toBe(401); expect(waitUntil).toHaveBeenCalledTimes(1); await settle(); const lines = error.mock.calls.map((args) => args[0] as { name?: string; hook?: string }); expect(lines).toContainEqual( expect.objectContaining({ name: "hook.after_failed", hook: "session.afterEnd" }), ); });});The trace of a request
Section titled “The trace of a request”Each answer of handle carries the header x-authtempo-trace, with the trace id of the request. Each event of that request holds the same traceId. A browser on a trusted origin can read the header, because core exposes it there.
- Ask the person for the value of
x-authtempo-trace, or read it from the network panel. - Search the sink for that
traceId. Therequestevent names the route, the status, the outcome, and the code.
Core makes a new trace id for each request. With observe.trustTraceparent: true, a valid W3C traceparent header gives the trace id and the parent span id. An invalid or all-zero header is ignored. A client trace id is off by default, because a client could join its requests to the trace of another person. With it on, the trace id and the parent span id of the client reach a sink as they are. No scrub of core or of @authtempo/observe touches them.
What an event can hold of an address
Section titled “What an event can hold of an address”By default an event holds no IP, no user agent, and no email. observe.include turns each one on:
| Key | Values | What the event holds |
|---|---|---|
ip |
"none", "hash", "raw" |
ipHash, a keyed hash of 32 hex, or ip, the address of clientIp. With "raw", core drops a value that is not an IP address. |
userAgent |
"none", "raw" |
userAgent, at most 256 characters with no control character |
email |
"none", "hash" |
emailHash, a keyed hash of 32 hex. An event never holds a raw email. |
The keyed hash is HMAC-SHA256 under a key that HKDF derives from the current app secret. A rotation of the secret changes every hash, so a hash from before the rotation does not join a hash after it.
How it behaves
Section titled “How it behaves”emitis synchronous, and no flow waits for a sink. The buffer holdsobserve.bufferevents, 1000 by default. A push into a full buffer drops the event and counts it.- The flush runs after the answer. It calls
writeonce, and waits for it for at mostobserve.flushTimeoutMs, 2000 ms by default. - A lost batch counts as
sink_timeoutorsink_threw. The next batch starts with oneobserve.droppedevent that holds the counts.auth.observe.stats()answers the same counts in process. - Core cannot stop a sink that loops on the CPU in a synchronous
write. Such a sink holds the isolate, so keepwriteshort. - On Workers, the
waitUntilwork of one request has 30 seconds after the answer in all. EachwaitUntilof that request shares the time. - Core scrubs each event before the buffer, with or without a sink. The scrub replaces each secret value of the config with
***. It covers each string field that a flow passes, and the rawipanduserAgent. It skips the stamp fields: the event name, the level, the time, the trace ids, and the route key. The kind of each stamp field checks its value. Each sink of@authtempo/observescrubs again with its ownsecretslist. It skips the stamp fields, and each field of a closed list: the kindsenum,code,route, androutePath. - The
methodfield of therequestevent holds the method token of the request,HEADtoo. - A redirect counts as a failure only when core marked it with an error code. A
nextvalue of a client that holdsauth_errorgives no failure. analyticsEngineSinkwrites at most 200 data points in one flush,AE_MAX_POINTS. Analytics Engine takes at most 250 for each Worker invocation (Cloudflare limit, read 2026-10-21). The 50 others stay for the points of the app.- Over 200 chosen events in one batch, the sink writes the first 200 and throws. Core then counts each event of the batch in
sink_threw. So the count is higher than the true loss: it holds the 200 written points too. - Each OTLP post aborts after
timeoutMs. Each OTLP sink makes a randomservice.instance.idat its first write, so each isolate writes its own metric stream. - An event is telemetry, and it can drop. The audit table of the operator tools is the record of an operator act.
The health and readiness probes
Section titled “The health and readiness probes”GET /auth/health answers 200 { "status": "ok" } in every deployment, and reads no storage. GET /auth/ready exists only with observe.readiness: true. It checks the store, and answers 200 { "status": "ready" } or 503 not_ready. One result holds for 10 seconds. Deploy gives a probe for each host.
The default lines
Section titled “The default lines”With no sink, core writes each line of this table with console, with the text and the arguments of each release before. With a sink, core writes only the secret.low_entropy line, while createAuth reads the config. No sink gets that event. A line holds an event name, a provider name, a row id, an HTTP status, or an error name. It never holds a token, a code, a cookie, an address, or an error message. The Events page lists the fields of each event. A site check holds this table to the code.
| Line | Event | What to do |
|---|---|---|
authtempo: waitUntil threw; the flush has no hook |
observe.wait_until_threw |
Act. The waitUntil of handle threw, so the events of that request stay in the buffer. Bind it: (p) => ctx.waitUntil(p). |
authtempo: no waitUntil on Workers; the answer waited for the work after it |
observe.wait_until_missing |
Act. On Workers, handle got no waitUntil for a request with work after the answer. Core waited for that work before it answered, so the code went out. The answer time can then tell whether a phone number has an account. Pass waitUntil to the binding or to handle. |
authtempo: <path> has an estimated <bits> bits of entropy; 120 or more is recommended |
secret.low_entropy |
Act. Core starts, but the secret is weak. Make one with openssl rand -base64 32. |
authtempo: a stored value names secret version <version>, which is not configured |
secret.unknown_version |
Act. A row names a secret version that secrets lacks. Add the version back, or rewrap the rows. |
authtempo: unhandled error |
error.internal |
Act. A route threw and answered 500. Read the route and the error name. |
authtempo: the captcha port threw |
captcha.port_threw |
Act. The captcha port of the app threw. Core reads it as no answer. |
authtempo: the captcha did not answer |
captcha.no_answer |
Act. The captcha gave no answer, and captcha.onUnavailable let the flow go on. |
authtempo: the SMS port threw |
sms.port_threw |
Act. The SMS port of the app threw, or phone.message threw. Core reads it as "unavailable", and the send counted against phone.dailyCap. The line holds no number and no code. |
authtempo: an SMS after the answer was not sent |
sms.not_sent |
Act. A phone code request or a phone add answered { sent: true }, and its SMS did not go out after the answer. The reason capped means that phone.dailyCap is spent. The reason unavailable means that the SMS port did not send. The reason timeout means that the send passed 10 seconds. The person gets no code and no error. The line holds no number and no code. |
authtempo: hook event copy failed |
hook.copy_failed |
Act. Core could not copy the event of a hook. Keep the hook data plain. |
authtempo: before hook failed |
hook.before_failed |
Act. A before hook threw, and the flow answered hook_failed. Fix the hook. |
authtempo: after hook failed |
hook.after_failed |
Act. An after hook threw after the commit. The app’s own row for that id is missing. |
authtempo: user patch refused |
user.patch_refused |
Act. A user hook answered a change that core refuses. Fix the hook. |
authtempo: session patch refused |
session.patch_refused |
Act. session.beforeCreate answered a key or a type that core refuses. Fix the hook. |
authtempo: user hold gave up |
user.hold_gave_up |
Watch. A write on one user lost its race too often. |
authtempo: account delete gave up |
account.delete_gave_up |
Watch. An account delete lost its race too often. The person can try again. |
authtempo: email change gave up |
email_change.gave_up |
Watch. A change of address lost its race too often. |
authtempo: credential removal gave up |
credential.removal_gave_up |
Watch. The removal of a credential lost its race too often. |
authtempo: profile update gave up |
profile.update_gave_up |
Watch. A profile update lost its race too often. |
authtempo: username set gave up |
username.set_gave_up |
Watch. A username set lost its race too often. |
authtempo: phone set gave up |
phone.set_gave_up |
Watch. The set of a phone lost its race too often. |
authtempo: notice mail failed |
notice.mail_failed |
Act when it repeats. The mail port threw on a notice mail. The act itself kept its result. With the event sso_expiring, no sweep sends that notice again: the stage is claimed. A RangeError there means that the owner scan was cut. The scan skips each member with exactly one role below the owner rank. More than 100 other members (owners, comma lists of roles, and dynamic roles) cut it. With more than 50 role names below the owner rank, the scan skips no member. An owner past those 100 got no mail. The event sso.expiring and hooks.sso.expiring still ran. |
authtempo: claim mail failed |
claim.mail_failed |
Act when it repeats. A step of the new proof of a lost claim threw. The step is the limiter, a storage call of the new link or code, the app’s link or mail builder, or the mail port. The flow still answered 409 conflict. |
authtempo: email code count gave up |
email_code.count_gave_up |
Watch. The guess count of an email code lost its race too often. |
authtempo: second-factor challenge count gave up |
second_factor.count_gave_up |
Watch. The guess count of a challenge lost its race too often. |
authtempo: backup code spend gave up |
backup_code.spend_gave_up |
Watch. A backup code spend lost its race too often. |
authtempo: backup code replacement gave up |
backup_code.replace_gave_up |
Watch. A new set of backup codes lost its race too often. |
authtempo: a TOTP secret reseal failed |
totp.reseal_failed |
Act. A TOTP secret did not move to the current secret. Read Secrets. |
authtempo: a sealed value did not move to the current secret; it did not open, or a concurrent write changed it first |
secrets.rewrap_failed |
Act when it repeats. A sealed value did not move to the current secret. Run the rewrap again. |
authtempo: a signing key reseal failed |
jwt.key_reseal_failed |
Act. A signing key did not move to the current secret. |
authtempo: a signing key does not open under this secret; it retires |
jwt.key_unopened |
Act when no change was planned. secret changed, so a new key signs. |
authtempo: jwtMint.claims answered a value that is not an object |
jwt.claims_not_object |
Act. The claims function of the app answered a value that is not an object. |
authtempo: jwtMint.claims threw |
jwt.claims_threw |
Act. The claims function of the app threw. |
authtempo: passkey registration rejected |
passkey.registration_rejected |
Watch. A passkey registration did not verify. |
authtempo: passkey credential already registered |
passkey.already_registered |
Watch. A person registered a known passkey again. |
authtempo: passkey authentication rejected |
passkey.authentication_rejected |
Watch. A passkey sign-in did not verify. |
authtempo: passkey counter moved |
passkey.counter_moved |
Watch. The counter of a passkey went back, or two uses raced. |
authtempo: passkey credential id over 1023 bytes |
passkey.credential_id_too_long |
Watch. An authenticator sent a credential id over the WebAuthn bound. |
authtempo: social client secret failed |
social.client_secret_failed |
Act. Core could not make the client secret of a provider, such as the Apple key. |
authtempo: social token request failed |
social.token_request_failed |
Act when it repeats. The token request to a provider failed. |
authtempo: social token endpoint answered |
social.token_status |
Act when it repeats. The token endpoint of a provider answered an error status. Check the client secret. |
authtempo: social token answer has no token |
social.token_missing |
Act when it repeats. The token answer of a provider held no token. |
authtempo: social token answer refused |
social.token_refused |
Act when it repeats. The token answer of a provider said that the exchange failed, for example Slack’s ok: false. |
authtempo: social id token rejected |
social.id_token_rejected |
Watch. The ID token of a provider did not verify. |
authtempo: social nonce mismatch |
social.nonce_mismatch |
Watch. The nonce of an ID token did not match the request. |
authtempo: social id token used again |
social.id_token_replayed |
Watch. A token of the ID-token route came a second time. A rise can mean that a token leaked from an app. |
authtempo: social id token claims refused |
social.claims_refused |
Watch. An ID token failed the issuer or claim check of its provider, for example a token of another Entra ID tenant. |
authtempo: social user info failed |
social.user_info_failed |
Watch. The user info request to a provider failed. |
authtempo: social user info has a bad subject |
social.bad_subject |
Watch. The user info of a provider held a subject that core refuses. |
authtempo: oidc discovery request failed |
oidc.discovery_failed |
Act. The discovery request of an oidc provider failed. Check the issuer, or set endpoints. |
authtempo: oidc discovery answered |
oidc.discovery_status |
Act. The discovery document of an oidc provider answered an error status. |
authtempo: oidc discovery is not JSON |
oidc.discovery_not_json |
Act. The discovery document of an oidc provider is not JSON. |
authtempo: oidc discovery issuer mismatch |
oidc.issuer_mismatch |
Act. The discovery document names another issuer. Check issuer. |
authtempo: oidc discovery lacks an endpoint |
oidc.endpoint_missing |
Act. The discovery document lacks an endpoint. Set endpoints. |
authtempo: client metadata document refused |
oauth.client_metadata_refused |
Watch. Core refused the metadata document of a client. The reason names the rule, never a value. |
authtempo: client metadata member dropped |
oauth.client_metadata_member_dropped |
Watch. A metadata document names a value that core does not serve. Core drops the member and keeps the client. |
authtempo: client key set refused |
oauth.client_key_set_refused |
Watch. Core refused the key set of a client. |
authtempo: client metadata document dropped its client auth; refresh tokens and device codes revoked |
oauth.client_auth_dropped |
Watch. A metadata document changed its client auth to none. Core revoked the refresh tokens and device codes of the client. |
authtempo: a back-channel logout is dropped after 6 attempts |
oauth.logout_dropped_attempts |
Watch. A back-channel notice failed 6 times, and core dropped it. |
authtempo: a back-channel logout is dropped: the client refused it |
oauth.logout_refused |
Watch. A client refused a back-channel notice, and core dropped it. |
authtempo: a back-channel logout attempt failed |
oauth.logout_attempt_failed |
Watch. One delivery of a back-channel notice failed. |
authtempo: the back-channel logout delivery failed |
oauth.logout_delivery_failed |
Act when it repeats. The delivery step of the back-channel notices failed. |
authtempo: the delete of a refresh row in a revoked grant failed |
oauth.refresh_delete_failed |
Watch. A cleanup failed. The sweep deletes the row. |
authtempo: operator step failed |
operator.step_failed |
Act. One step of an operator act failed. Read the audit row of the act. |
authtempo: operator family end failed |
operator.family_end_failed |
Act. An operator act could not end a token family. |
authtempo: operator ban write gave up |
operator.ban_write_gave_up |
Act. A ban write lost its race too often. Run the ban again. |
authtempo: operator update gave up |
operator.update_gave_up |
Act. An operator update of a name or an image lost its race too often. Run the update again. |
authtempo: operator create mail failed |
operator.create_mail_failed |
Act when it repeats. The mail port threw on the invitation link or the reset link of an operator create. The user stays, and the answer says mailed: null. Ask the person to request a reset link or a magic link. |
authtempo: operator guard refused |
operator.guard_refused |
Act when no operator acted. The operator guard refused a caller. |
authtempo: operator read |
operator.read |
Watch. An operator read user data. This line is the record of the read. |
authtempo: operator route unauthorized |
operator.route_unauthorized |
Act when no operator acted. An operator route refused a caller. |
authtempo: role row invalid <rowId> |
role.row_invalid |
Act. A stored role row does not parse. Core skips it. |
authtempo: the sweep link step stopped |
sweep.link_stopped |
Act when it repeats. The sweep stopped its link step. The next sweep tries again. |
authtempo: the sweep outbox step stopped |
sweep.outbox_stopped |
Act when it repeats. The sweep stopped its outbox step. The next sweep tries again. |
authtempo: the sweep pending end step stopped |
sweep.pending_end_stopped |
Act when it repeats. The sweep stopped its pending end step. The next sweep tries again. |
authtempo: the sweep sso recheck step stopped |
sweep.sso_recheck_stopped |
Act when it repeats. The sweep stopped its recheck of the verified SSO domains. The next sweep tries again. |
authtempo: the sweep organization rest step stopped |
sweep.organization_rest_stopped |
Act when it repeats. The sweep stopped its step of the rows that an account delete left. The next sweep tries again. |
authtempo: the sweep anonymous step stopped |
sweep.anonymous_stopped |
Act when it repeats. The sweep stopped its step of the anonymous users past anonymous.ttlDays. The next sweep tries again. |
authtempo: the sweep sso expiry step stopped |
sweep.sso_expiry_stopped |
Act when it repeats. The sweep stopped its expiry notices of one kind: SAML certificates, SCIM tokens, or setup links. The other kinds still ran. The next sweep tries again. |
authtempo: the anonymous upgrade cleanup failed |
anonymous.cleanup_failed |
Watch. A sign-in replaced an anonymous user, but the end of its session or its delete failed. The sign-in holds. The sweep deletes the user later. |
authtempo: sso guard refused |
sso.guard_refused |
Act when no owner acted. The SSO manager guard refused a caller at the named step. |
authtempo: sso failed |
sso.failed |
Act when it repeats for one connection. An SSO sign-in failed at the named step. Check the setup of the provider. |
authtempo: sso denied |
sso.denied |
Watch. The provider answered an error to the sign-in, such as a person who said no. |
authtempo: sso refused |
sso.refused |
Watch. The SSO resolution refused a profile, for example an address outside the verified domains. |
authtempo: sso status write failed |
sso.status_write_failed |
Act when it repeats. Core could not write the last success or the last failure of a connection. The sign-in kept its result. The status of GET /sso/connections stays old until a later sign-in writes it. |
authtempo: saml certificate expired |
saml.certificate_expired |
Act. A certificate of a SAML connection is past its end date. Upload the new certificate of the provider. |
authtempo: an sso client secret did not open |
sso.client_secret_unopened |
Act. The client secret of an OIDC connection does not open under the configured secrets. Set the secret of the connection again. |
authtempo: sso domain unverified |
sso.domain_unverified |
Watch. A resolver did not give the record of a domain. Publish the record and verify again. |
authtempo: sso domain lost |
sso.domain_lost |
Act. The recheck lost a verified domain, so its claim and its enforce are off. Publish the record and verify again. |
authtempo: cognito legacy verify failed <reason> |
none | Act when it is every user. Cognito refused an imported user, or did not answer. |
authtempo compat: <note> |
none | Read once at start. An option of the compatibility package changes no promise. |
authtempo compat: a credential account row has no password; … |
none | Act. A Better Auth row has no hash. Give the row a hash, or delete it. |
authtempo compat: organizationHooks.<name> returned data that changes <fields>; … |
none | Act. An organization hook of the app returned changed data. The write stops. |
authtempo compat: databaseHooks.session.create.before changed <fields>; … |
none | Act. The session hook of the app changed a field that core drops. |
The rows that start with authtempo compat: come from the compatibility package, and the cognito row from @authtempo/legacy-hashes. They have no event. The compatibility package writes its notes with console.info.
If it fails
Section titled “If it fails”- No event in a day of traffic:
handlegets nowaitUntil, orobservability.enabledisfalse. On Node and Bun, the flush timer does not run. observe.droppedwithbuffer_fullabove 0: the buffer filled before a flush. Raiseobserve.buffer, or on Node and Bun flush more often.sink_threwcounts withanalyticsEngineSink: one batch held more than 200 chosen events. Give the sink a shortereventslist. A largerobserve.buffermakes the batch larger, not smaller.sink_timeoutcounts: the collector does not answer inobserve.flushTimeoutMs.- Many
authtempo: unhandled errorlines with a storage error: a migration is missing. Upgrades tells how to apply it. hook_failedanswers: read theauthtempo: before hook failedline of the same time.