PostHog / posthog-js-lite

Reimplementation of posthog-js to be as light and modular as possible.
https://posthog.com/docs/libraries
MIT License
70 stars 36 forks source link

fix: Axios issue in Cloudflare workers #132

Closed benjackwhite closed 11 months ago

benjackwhite commented 12 months ago

Problem

Hopefully fixes https://github.com/PostHog/posthog-js-lite/issues/127 And also https://github.com/PostHog/posthog-js-lite/issues/129

Changes

The current version of Axios fixes a security issue but has other issues regarding environments like Cloudflare. Tried to look for a general fix here but the world of polyfilled Fetch is a mess to say the least... In the end, the workaround that made most sense was to simply use fetch if it is defined (which it is in custom environments like Cloudflare workers.

Also added an example project for testing this - managed to recreate the issue and this PR fixes it.

Release info Sub-libraries affected

Bump level

Libraries affected

Changelog notes