fix: match NOT_LISTENING_ERROR against local-dev runtime message#230
Open
juanibiapina wants to merge 2 commits into
Open
fix: match NOT_LISTENING_ERROR against local-dev runtime message#230juanibiapina wants to merge 2 commits into
juanibiapina wants to merge 2 commits into
Conversation
The isNotListeningError helper uses .includes() to detect the error. In production the runtime returns 'The container is not listening in the TCP address ...', but in local dev (wrangler dev) it returns 'container is not listening ...' without the leading 'the'. The current constant 'the container is not listening' is not a substring of the local-dev variant, so the readiness loop never recognises the error and retries indefinitely. Shorten the constant to 'container is not listening' so it matches both variants.
Add a unit test that mocks the local-dev error message (without the leading 'the') and asserts doStartContainer returns immediately instead of retrying. The test counts fetch calls: 2 with the fix (recognised on first try), 3 without (falls through to retry).
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.
Problem
The
isNotListeningErrorhelper uses.toLowerCase().includes(matchingString)to detect the error. In production the runtime returns:In local dev (
wrangler dev) the runtime returns:The current constant
'the container is not listening'is not a substring of the local-dev variant (which omits the leading "the"), soisNotListeningErrornever returns true. The readiness loop inwaitForPort/startAndWaitForPortsretries indefinitely and the Durable Object blocks forever.Fix
Shorten the constant from
'the container is not listening'to'container is not listening'. This is a substring of both variants, so the.includes()check works in both environments.Environment
Not sure whether the Docker runtime (OrbStack vs Docker Desktop) matters for this particular issue. Mentioning it in case it is relevant.