Provide visibility to errors if segment events do not send

Open
#1,035 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
frontend

Research direction

Start in packages/browser/src/core/events/index.ts around line 264, then read the eventProperties type in packages/browser/src/core/events/interfaces.ts around line 22. Trace how analytics.track reports successful sends and handles serialization or other event errors. Done means consuming applications can observe successful sends and receive failures instead of having them silently swallowed.

Written by the indexing model from the issue text.

Description

bug enhancement

Found that we're unable to see when segment events have successfully sent: when calling analytics.track the app receives undefined as a response (even if the event has been sent successfully). When an event has not been successfully sent there have been multiple times an error gets swallowed inside analytics-next and never surface to the consuming app.

Examples:

  • When sending additional eventProperties I accidentally sent data that could not be json stringified saw in the debugger that the even failed here but we did not have access to the error so an error was never thrown inside our app even though we have analytics.track wrapped in a try/catch. There's no way to have typescript catch this error prior to sending because eventProperties are type to take any value
  • We were unable to see that the utm-parameter 'search' should be passed in as a string - https://github.com/segmentio/analytics-next/pull/839 so we were silently not sending events.
Dominant language
TypeScript
Stars
477
Forks
160
Avg merge
6h 19m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from segmentio/analytics-next

All issues in segmentio/analytics-next

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.