Skip to content

Fix grpc-status sent as initial header instead of trailer.#1

Merged
samuel-williams-shopify merged 3 commits into
socketry:mainfrom
jmreid:fix-grpc-trailer-headers
Mar 10, 2026
Merged

Fix grpc-status sent as initial header instead of trailer.#1
samuel-williams-shopify merged 3 commits into
socketry:mainfrom
jmreid:fix-grpc-trailer-headers

Conversation

@jmreid

@jmreid jmreid commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

When a gRPC response includes a body, grpc-status must be sent as an HTTP/2 trailing HEADERS frame. However, invoke_service was adding grpc-status to response.headers before send_response called trailer!, causing it to be included in the initial headers instead of trailers.

Call trailer! at the start of invoke_service to mark the header position. Since trailer! uses ||= for @tail, the subsequent call in send_response is a no-op, and any headers added after our call (including grpc-status) are correctly positioned as trailers.

samuel-williams-shopify and others added 2 commits March 10, 2026 18:02
When a gRPC response includes a body, grpc-status must be sent as an
HTTP/2 trailing HEADERS frame. However, invoke_service was adding
grpc-status to response.headers before send_response called trailer!,
causing it to be included in the initial headers instead of trailers.

Call trailer! at the start of invoke_service to mark the header
position. Since trailer! uses ||= for @tail, the subsequent call in
send_response is a no-op, and any headers added after our call
(including grpc-status) are correctly positioned as trailers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@samuel-williams-shopify samuel-williams-shopify merged commit 7636f9a into socketry:main Mar 10, 2026
16 of 20 checks passed
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