Skip to content

fix: validate track payload#1811

Merged
filipecabaco merged 4 commits intomainfrom
fix/validate-track-payload
Apr 18, 2026
Merged

fix: validate track payload#1811
filipecabaco merged 4 commits intomainfrom
fix/validate-track-payload

Conversation

@filipecabaco
Copy link
Copy Markdown
Member

@filipecabaco filipecabaco commented Apr 14, 2026

What kind of change does this PR introduce?

Properly handle track payload

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 14, 2026

Coverage Status

Coverage is 91.784%fix/validate-track-payload into main. No base build found for main.

Comment thread lib/realtime_web/channels/realtime_channel/presence_handler.ex Outdated
Comment thread lib/realtime_web/channels/realtime_channel/presence_handler.ex Outdated
@filipecabaco filipecabaco force-pushed the fix/validate-track-payload branch 2 times, most recently from 851fe91 to f0f9c18 Compare April 17, 2026 14:29
@filipecabaco filipecabaco force-pushed the fix/validate-track-payload branch from f0f9c18 to 66eccc8 Compare April 17, 2026 14:30
shutdown_response(socket, "Track message size exceeded")

{:error, :invalid_payload} ->
log_error(socket, "InvalidPresencePayload", :invalid_payload)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh we need to include this error in the README: https://github.com/supabase/realtime#error-operational-codes


{:error, :invalid_payload} ->
log_error(socket, "InvalidPresencePayload", :invalid_payload)
{:reply, {:error, %{reason: "Presence track payload must be a map"}}, socket}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any idea what our realtime-js library will see when this error happens? I don't remember how we surface such error on track

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.

not sure either will try to verify but overall errors in the clients lib ain't the best from what I recall

Copy link
Copy Markdown
Member

@edgurgel edgurgel left a comment

Choose a reason for hiding this comment

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

Added a question and a small doc change but other than that LGTM

@filipecabaco filipecabaco merged commit 668a635 into main Apr 18, 2026
8 checks passed
@filipecabaco filipecabaco deleted the fix/validate-track-payload branch April 18, 2026 08:04
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.

3 participants