Self-hosted: experiment events go to Flagsmith Cloud unless eventsApiUrl is set
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
Research direction
Start with sdk/events.ts and the Flagsmith constructor, where the issue says the event URL is selected and eventProcessorConfig is passed through. Compare that URL handling with how the analytics URL is derived from apiUrl. The reproduction script records request destinations; done when events from a self-hosted setup go to the intended instance, or construction warns when they would go to Flagsmith Cloud.
Written by the indexing model from the issue text.
Description
With apiUrl pointing at a self-hosted Flagsmith and enableEvents: true, trackEvent and the exposures that getExperimentFlag records are sent to Flagsmith Cloud (https://events.api.flagsmith.com/v1/events), not to the self-hosted instance. Nothing warns: the self-hosted instance never sees the events, its experiments show no data, and each event (the identity's identifier, the event name, any value) plus the environment key leaves the network.
Where: EventProcessor takes opts.eventsApiUrl || DEFAULT_EVENTS_API_URL (sdk/events.ts; DEFAULT_EVENTS_API_URL = 'https://events.api.flagsmith.com/'), and the Flagsmith constructor passes only eventProcessorConfig through, so the default is used whatever apiUrl is. The analytics URL, by contrast, is derived from apiUrl (new URL(ANALYTICS_ENDPOINT, apiUrl)), so a self-hosted setup gets analytics right and events wrong.
Reproduction (no network: a custom fetch records the destinations): https://github.com/tharunkumardeveloper/turnout/blob/main/spikes/sdk-events-url/repro.mjs
apiUrl (self-hosted): http://127.0.0.1:55651/api/v1/
GET http://127.0.0.1:55651/api/v1/environment-document/
POST https://events.api.flagsmith.com/v1/events
Same result on 9.4.0 and 9.5.0. Found by accident while writing an example against a self-hosted 2.291.0: its experiment stayed empty while the events went to Cloud.
Suggested fix, either:
- When
apiUrlis set and isn't Flagsmith's own edge API, derive the events URL from it, as analytics already is:apiUrlwithout its trailingv1/aseventsApiUrl, so events go to{host}/api/v1/eventson the same instance (what Turnout passes today, and it works against 2.291.0); or - at least log a warning at construction when
enableEventsis true,apiUrlis not the default, andeventsApiUrlisn't set.
Option 1 matches how the analytics URL already works. Happy to open a PR for either.
- Dominant language
- TypeScript
- Stars
- 30
- Forks
- 30
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Flagsmith/flagsmith-nodejs-client
-
Difficulty 2/5 Under an hour Newbie friendliness 85/100
Flagsmith/flagsmith-nodejs-client#304 ·
Maintainers usually reply within 2 days
-
Experimentation events are dropped when they're tracked faster than one batch round-trip, and the buffer can't be raised past Flagsmith's 2 MiB batch limitPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 42/100
Flagsmith/flagsmith-nodejs-client#330 ·
Maintainers usually reply within 2 days
-
Dependency DashboardOpen
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Flagsmith/flagsmith-nodejs-client#286 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Flagsmith/flagsmith-nodejs-client#273 · 1 comment ·
Maintainers usually reply within 2 days
-
[sdk/local-evaluation] Duplicate identity override entries silently drop feature overridesPossibly taken @xolott-ark claimed this 203 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Flagsmith/flagsmith-nodejs-client#267 · 5 comments ·
Maintainers usually reply within 2 days
All issues in Flagsmith/flagsmith-nodejs-client
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
earendil-works/pi#12615 ·
Maintainers usually reply within 1 day
-
My Caps shows "Shared" on private Caps that were never sharedPossibly taken @AksharP5 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CapSoftware/Cap#4569 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
OHDSI/Data2Evidence#3749 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Maintainers usually reply within 1 day
-
bug from-app needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
nightly-labs/openbot#17688 ·
Maintainers usually reply within 1 day