Fix OIDC token fetch error swallowing in entrypoint.sh#11655
Merged
Conversation
-sf caused curl to exit silently on any failure (connection error, HTTP 4xx/5xx), producing empty stdout. Python then got empty stdin and crashed with an opaque JSONDecodeError instead of a useful message. Drop -f, capture the response in a variable, and emit actionable error messages when the response is empty or not valid JSON. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Code Coverage Report: Only Changed Files listed
Minimum allowed coverage is |
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.
Purpose
The deployment was failing because the
wwwuser can't access/.fly/api— the Unix socket is owned by root.First pass (previous commit) improved the error message by replacing the opaque
JSONDecodeErrorwith an explicit check. That confirmed the root cause: empty response = permission denied, not a bad endpoint.This commit fixes the actual problem.
USER wwwis removed from the Dockerfile beforeENTRYPOINTso the script starts as root and can successfully reach/.fly/api. After fetching and writing the OIDC token, the script drops to thewwwuser viasu --preserve-environmentbefore exec'ing chamber or the app command. The token file ischown'd towwwfirst so chamber can readAWS_WEB_IDENTITY_TOKEN_FILEafter the privilege drop.The
drop_to_wwwhelper also handles the case where the entrypoint is already running aswww(e.g. local testing), so nothing breaks in that path.🤖 Generated with Claude Code