Skip to content

fix(templates): preserve error response headers in publish chains - #1135

Merged
felipefreitag merged 1 commit into
resend:canaryfrom
claygeo:fix/template-chain-error-headers
Oct 15, 2026
Merged

felipefreitag merged 1 commit into
resend:canaryfrom
claygeo:fix/template-chain-error-headers

Conversation

@claygeo

@claygeo claygeo commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Chaining templates.create(...).publish() or templates.duplicate(...).publish() currently keeps the initial request's error but replaces its response headers with null. For example, a 429 loses Retry-After, and a validation error loses its request ID. This preserves the headers of that same failed request, consistent with #713. The publish request is still skipped after an initial failure.

Tests cover both public methods, transport failures with no headers, and successful chains returning the publish response's headers. The two HTTP-error regressions fail before the fix and pass afterward.

Validation: 560 tests pass (4 existing TODOs); typecheck, build and Biome pass. Also verified both methods through the built ESM package with mocked fetch. No live API calls or email sends were used.

AI assistance: implemented and tested with Codex, with a separate review of the plan and diff. All reproduction data is synthetic.


Summary by cubic

Fixes template publish chains so a failed create() or duplicate() request keeps its response headers when .publish() is called after it. The error was already preserved, but headers were replaced with null, dropping useful metadata like Retry-After on a 429 or the request ID on a validation error. The publish request is still skipped after an initial failure.

Adds tests for both public methods, transport failures (where headers are absent), and successful chains returning the publish response's headers.

Written for commit 2cee5ba. Summary will update on new commits.

Review in cubic

Return the failed create or duplicate request headers when publish is chained. Cover HTTP errors, transport failures, and successful publish response headers through the public template methods.
@claygeo
claygeo requested a review from a team as a code owner October 5, 2026 19:05
@claygeo
claygeo requested a review from kierstiesparza October 5, 2026 19:05
@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Oct 6, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/resend@1135

commit: 2cee5ba

@felipefreitag
felipefreitag merged commit 10d66ce into resend:canary Oct 15, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants