fix(workspaces): retry file processor container provisioning#648
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(workspaces): retry file processor container provisioning#648posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
The Containers runtime throws "there is no container instance that can be provided to this durable object" when no instance is available to back the WorkspaceFileProcessor durable object (transient provisioning lag or a fully busy pool). Previously this bubbled straight up through preview generation, extraction, and PDF upload validation, failing the operation on the first miss. Retry acquisition (getRandom + startAndWaitForPorts) with exponential backoff, scoped to that specific transient error; all other errors still surface immediately. The retry wraps only provisioning, which runs before the request body stream is consumed, so it never re-reads a consumed stream. Generated-By: PostHog Code Task-Id: 66783ae2-2a28-419c-b710-2d31c9526cc2
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
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
Workspace file preview generation started throwing "there is no container instance that can be provided to this durable object" right after the R2 migration (#643). The
WorkspaceFileProcessorCloudflare Container can't always be provisioned the instant we ask for it — transient provisioning lag (notably just after a deploy) or a fully busy pool — and the error was failing the operation on the first miss.This makes container acquisition resilient:
requestWorkspaceFileProcessornow retriesgetRandom+startAndWaitForPortswith exponential backoff (4 attempts, ~7s total), scoped to that specific transient error. Any other error still surfaces immediately. The retry wraps only provisioning — which runs before the request body stream is consumed — so it never re-reads a consumed stream. The fix also covers the extraction and PDF-upload-validation paths that share this helper.Why
A production error was silently failing the workspace file preview flow when it hit, immediately after the R2-migration deploy. Retrying past transient provisioning misses fixes the observed failure without changing container capacity.
Test plan
workspace-file-processor.test.ts: retries then succeeds on the provisioning error; does not retry unrelated errors; gives up after exhausting attempts.pnpm checkand related workspace test suites pass.Created with PostHog Code from an inbox report.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.