fix: accept Plausible tracker's compact event keys in proxy #32

Merged
ronnyandre merged 1 commit from fix/plausible-event-validation into main 2026-11-17 12:39:58 +01:00
Owner

Problem

Every request to /api/plausible/event returned 400 Invalid event, so Plausible has recorded nothing through the proxy (pageviews included).

The validator required a string name, but Plausible's tracker script sends compact keys — {"n":"pageview","u":...,"d":"fliary.com"}.

Fix

Accept either n (tracker script) or name (documented Events API). Still rejects non-objects/arrays, malformed JSON, and bodies over 2 KB.

Verify

After deploy, pageview / engagement POSTs to /api/plausible/event should return 202, and visits should appear in Plausible.

🤖 Generated with Claude Code

## Problem Every request to `/api/plausible/event` returned `400 Invalid event`, so Plausible has recorded nothing through the proxy (pageviews included). The validator required a string `name`, but Plausible's tracker script sends compact keys — `{"n":"pageview","u":...,"d":"fliary.com"}`. ## Fix Accept either `n` (tracker script) or `name` (documented Events API). Still rejects non-objects/arrays, malformed JSON, and bodies over 2 KB. ## Verify After deploy, `pageview` / `engagement` POSTs to `/api/plausible/event` should return `202`, and visits should appear in Plausible. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The tracker script sends the event name as `n` (with `u`, `d`, ...), not
`name`, so the proxy's validator rejected every event with 400 "Invalid
event" — pageviews included. Accept either `n` or `name`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ronnyandre deleted branch fix/plausible-event-validation 2026-11-17 12:39:59 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ronnyandre/fliary!32
No description provided.