Repository navigation
fix(cloudflare/statestore): report a rejected credential as an authentication error - #3098
Open
pattobrien wants to merge 1 commit into
Open
pattobrien wants to merge 1 commit into
pattobrien wants to merge 1 commit into
Conversation
Contributor
|
Install the packages built from this commit: alchemypnpm install https://pkg.alchemy.run/alchemy/pr:3098:275bfd8@alchemy.run (21)pnpm install https://pkg.alchemy.run/@alchemy.run/better-auth/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/git/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/drizzle/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/acme/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/planetscale/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/neon/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/hetzner/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/railway/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/fly/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/cloudflare/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/gcp/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/aws/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/domain/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/kubernetes/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/docker/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/redis/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/sql/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/cloudflare-runtime/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/frontend-frameworks/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/node-utils/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/pkg/pr:3098:275bfd8Transitive Dependencies (17)pnpm install https://pkg.alchemy.run/@distilled.cloud/aws/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/acme/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/core/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/planetscale/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/neon/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/s3/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/hetzner/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/railway/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/fly-io/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/github/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/aws4signer/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/cloudflare/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/iceberg/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/gcp/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/effect-cluster/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@alchemy.run/rivet/pr:3098:275bfd8pnpm install https://pkg.alchemy.run/@distilled.cloud/rivet/pr:3098:275bfd8Published |
…tication error Cloudflare answers a rejected credential with 401 'Authentication error' four times and then rate limits it, so a state store lookup retried by the SDK ended as 'Rate limited ... Run the command again'. The lookup now keeps the rejection and names authentication as the problem. It is still retried as before, because a valid token can be rejected for a moment under load.
pattobrien
force-pushed
the
fix/state-store-rejected-credential
branch
from
November 25, 2026 15:37
132a5b7 to
275bfd8
Compare
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.
A Cloudflare credential that Cloudflare rejects now fails state store init as an authentication error. Before, it ended as a rate limit with "Run the command again".
Builds on #2605, which made a lookup whose answer is unknown fail instead of bootstrapping.
Cloudflare answers a rejected token with 401
Authentication errorfour times, then rate limits that token with 429. The SDK retriesAuthentication errornine times, so the lookup always ended on the 429.It does not fail fast. A dead token still takes about 24 s. Failing on the first
Unauthorizedwould be quick, but it can turn a valid token into a hard failure: Cloudflare returnsAuthentication errorfor valid tokens for a moment under high request concurrency, which is why distilled marks it retryable, and since beta.85 every state store init makes this lookup. So the lookup keeps the SDK's full retries and only the reported error changes. A valid token that blips gets one extra attempt and succeeds as before.Evidence
CI=true, an emptyALCHEMY_HOME, a well-formed token that was never issued:main, 24.8 s):Lifecycle.test.ts› "a rejected Cloudflare credential fails as an authentication error" runs the real init against Cloudflare with a random token. It passes in 24.3 s.TransientErrors.test.ts›keepCredentialRejectiondrives the realworkers.getSubdomainagainst stubbed replies:Merge Danger
Door: two-way
Reverting restores the previous message. No state or stored data changes.
Blast Radius: narrow
Only the Cloudflare state store's existence lookups. A lookup that hits
Unauthorizedonce and then succeeds makes one more request than before. A run that starts while Cloudflare is already rate limiting the same dead token (another job used it in the last few minutes) sees only 429s and still gets "Rate limited … Run the command again".