fix: pg:backups:capture -v null guard on undefined logs - #3832
Merged
Conversation
When --verbose polling encounters a permission error the API may return a transfer object with logs undefined, causing displayLogs to throw TypeError: undefined is not iterable. Widen the displayLogs parameter type to accept undefined and default to an empty array via nullish coalescing, so the method is a no-op instead of crashing. Fixes: src/lib/pg/backups.ts:22 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
heroku-johnny
temporarily deployed
to
AcceptanceTests
July 27, 2026 19:14 — with
GitHub Actions
Inactive
heroku-johnny
temporarily deployed
to
AcceptanceTests
July 27, 2026 19:14 — with
GitHub Actions
Inactive
heroku-johnny
temporarily deployed
to
AcceptanceTests
July 27, 2026 19:14 — with
GitHub Actions
Inactive
heroku-johnny
temporarily deployed
to
AcceptanceTests
July 27, 2026 19:14 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TypeError: undefined is not iterablecrash inheroku pg:backups:capture -vwhen the Postgres API returns a permission error during verbose pollingbackup.logscan beundefinedwhen a permission error is returned, butdisplayLogsiterated it unconditionallydisplayLogsparameter type fromBackupTransfer['logs']toBackupTransfer['logs'] | undefinedand added a?? []null-coalescing guard so the method is safely a no-op whenlogsis absentFile:
src/lib/pg/backups.ts:22Fixes #1294
Ref: W-23597889
Test plan
heroku pg:backups:capture -vagainst an app where the Postgres add-on does not have backup permissions — confirm noTypeErroris thrown and the command exits cleanlyheroku pg:backups:capture -vagainst an app with a healthy Postgres add-on — confirm verbose log lines are still printed as before (happy path unchanged)🤖 Generated with Claude Code