Skip to content
refs

Deliver PostHog events with a redirect mode Workers accept

Aman Kumarcommitted Oct 9, 20266cbb981parent 72a69be

The Workers runtime rejects fetch redirect "error" with a TypeError. The delivery catch logged it as a transport failure, so no event reached PostHog. Node accepts "error", so the tests passed and asserted the wrong value. Use "manual": a redirect is not followed and its 3xx status logs as a failure. Plannotator review returned no changes requested. All 103 tests and typecheck pass.

1 decision

Send PostHog captures with fetch redirect "manual" and treat any non-2xx response as a delivery failure.

Why

  • workerd supports only "follow" and "manual" and throws on "error"
  • Not following redirects keeps the token on the allowlisted host

Touches

  • analytics.ts
Evidence · 2
  • workerd error text: Invalid redirect value, must be one of "follow" or "manual"
  • A direct capture with the same payload returned 200 {"status":"Ok"}
2 files changed · +2 −2
apps/backend/analytics.ts+1 −1
apps/backend/test/analytics.test.ts+1 −1