From d69ec7f7a9aab7ec88203ae75d58d72dd72b6d7b Mon Sep 17 00:00:00 2001 From: ZCode Date: Mon, 21 Sep 2026 09:16:21 +0000 Subject: [PATCH] fix(analytics): the Track API payload field is 'name', not 'event' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Second half of the envelope fix: ITrackPayload is {name, properties, profileId} — sending 'event' is rejected with 400 "payload/name Invalid input: expected string", which the module swallows by design. Verified against packages/validation/src/track.validation.ts and the SDK's track(name, properties) signature. --- backend/app/services/analytics.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/app/services/analytics.py b/backend/app/services/analytics.py index 3d34804..deb5268 100644 --- a/backend/app/services/analytics.py +++ b/backend/app/services/analytics.py @@ -39,7 +39,9 @@ async def track(event: str, properties: dict[str, Any] | None = None, profile_id return # OpenPanel's Track API takes {type, payload:{…}} (same envelope the browser SDK # sends) — a flat body is rejected with 400, which this module swallows by design. - inner: dict[str, Any] = {"event": event, "properties": properties or {}} + # The payload field is "name" (ITrackPayload in packages/validation) — "event" is + # rejected with a 400 that this module swallows. + inner: dict[str, Any] = {"name": event, "properties": properties or {}} if profile_id: inner["profileId"] = profile_id body = {"type": "track", "payload": inner}