If the backend when fetching feature flags via /api/feature-flag-endpoint
returns a non-ok response (e.g. 502) the error will be silently ignored and
the feature flags won't be updated
This fixes the issue when feature flag poller is running and the backend
is returning 502 when reloading feature flags the library won't throw a
runtime error which is unhandled and causes a unhandled rejection error
in the node process.
If the DEBUG environment variable is set with posthog:node the silently
ignored error mentioned above will be logged to the console
fixes #52
Checklist
[X] Tests for new code (if applicable)
[ ] TypeScript definitions (module.d.ts) updated and in sync with library exports (if applicable)
Changes
BREAKING CHANGE
If the backend when fetching feature flags via
/api/feature-flag
-endpoint returns a non-ok response (e.g. 502) the error will be silently ignored and the feature flags won't be updatedThis fixes the issue when feature flag poller is running and the backend is returning 502 when reloading feature flags the library won't throw a runtime error which is unhandled and causes a unhandled rejection error in the node process.
If the
DEBUG
environment variable is set withposthog:node
the silently ignored error mentioned above will be logged to the consolefixes #52
Checklist