Skip to content

feat: added replay lifecycle hooks docs#17598

Merged
logaretm merged 3 commits intomasterfrom
awad/replay-lifecycle-hooks
May 5, 2026
Merged

feat: added replay lifecycle hooks docs#17598
logaretm merged 3 commits intomasterfrom
awad/replay-lifecycle-hooks

Conversation

@logaretm
Copy link
Copy Markdown
Member

@logaretm logaretm commented May 4, 2026

This PR adds documentation for the replay client lifecycle hooks, it was released in 10.50.0 via getsentry/sentry-javascript#20369

I initially thought about adding lifecycle.mdx file and a sidebar item for replays, but maybe it is a bit of an overkill.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sentry-docs Ready Ready Preview, Comment May 5, 2026 5:32pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
develop-docs Ignored Ignored Preview May 5, 2026 5:32pm

Request Review

Copy link
Copy Markdown
Collaborator

@inventarSarah inventarSarah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks good to me👍
And I agree, in the current setup, this seems to be the best place for this content.

Comment thread docs/platforms/javascript/common/session-replay/understanding-sessions.mdx Outdated
Co-authored-by: Sarah Mischinger <sarah@codingwriter.com>
Comment on lines +139 to +147
client.on('replayStart', ({ sessionId, recordingMode }) => {
// recordingMode: 'session' | 'buffer'
console.log(`Replay ${sessionId} started in ${recordingMode} mode`);
});

client.on('replayEnd', ({ sessionId, reason }) => {
// reason: 'manual' | 'sessionExpired' | 'sendError' | 'mutationLimit'
// | 'eventBufferError' | 'eventBufferOverflow'
console.log(`Replay ${sessionId} ended: ${reason}`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The documentation for replayStart and replayEnd hooks incorrectly uses sessionId instead of replayId in the payload example, which will be undefined for users.
Severity: MEDIUM

Suggested Fix

Update the documentation to replace sessionId with the correct identifier, replayId, in the code examples for the replayStart and replayEnd lifecycle hooks to match the actual SDK implementation.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location:
docs/platforms/javascript/common/session-replay/understanding-sessions.mdx#L139-L147

Potential issue: The documentation for the `replayStart` and `replayEnd` lifecycle hooks
incorrectly uses `sessionId` in the event payload examples. The Sentry JS Replay SDK
consistently uses `replayId` for the replay identifier in other contexts, such as
`replay.getReplayId()` and the wire format `replay_id`. Users who follow the
documentation and attempt to destructure `{ sessionId }` from the event payload will
receive `undefined`, causing their implementation to fail silently.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, sessionId is the right payload value. No replayId is present.

@logaretm logaretm merged commit 71ac21c into master May 5, 2026
18 checks passed
@logaretm logaretm deleted the awad/replay-lifecycle-hooks branch May 5, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants