Hotfix 0.47.10 — fix EACCES on /app/.next/cache in production#423
Closed
elfensky wants to merge 1 commit into
Closed
Hotfix 0.47.10 — fix EACCES on /app/.next/cache in production#423elfensky wants to merge 1 commit into
elfensky wants to merge 1 commit into
Conversation
…t/cache
The Chainguard runner (cgr.dev/chainguard/node:latest) has no `nonroot` entry
in /etc/passwd — uid 65532 is named `node` — so the runner-stage
`COPY --chown=nonroot:nonroot` lines silently fell back to root (0:0), leaving
/app/.next root-owned. The container runs as uid 65532, so the Next.js image
optimizer's mkdir('.next/cache/images') failed with EACCES and flooded logs
with unhandledRejection on every remote-avatar optimization.
Switch all three runner COPY lines to numeric --chown=65532:65532. Hotfix off
main (v0.47.10); the same fix is already on develop as 0.52.1. The runner COPY
change is identical to the develop fix, which was verified by building the real
image and confirming /app/.next is uid=65532 with a successful cache write.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
|
Superseded: releasing the full develop line (incl. this cache fix as 0.52.1) to main as v0.52.1 instead of an isolated hotfix. Closing in favor of the develop -> main release PR. |
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 production container floods logs with:
Root cause: the Chainguard runtime (
cgr.dev/chainguard/node:latest) has nononrootentry in/etc/passwd— uid 65532 is namednode. So the runner-stageCOPY --from=builder --chown=nonroot:nonroot …lines silently fall back to root (0:0), leaving/app/.nextroot-owned (mode 755). The container runs as uid 65532, so the Next.js image optimizer's first remote-avatar optimization (mkdir('.next/cache/images'), triggered by Discord/GitHub/Google/Gravatar avatars) fails withEACCESand rejects on every subsequent cacheable image request.Fix
Switch the three runner
COPYlines to numeric--chown=65532:65532(numeric IDs need no passwd lookup), so the runtime user owns the standalone tree and creates.next/cacheon demand.Verification
Reproduced the exact production state in a controlled build (
/app/.nextuid=0,mkdir FAILED:EACCES), then confirmed a realDockerfile.appbuild with the numeric chown yields/app/.nextuid=65532and a successful.next/cache/imageswrite. Probe against the deployed container showed/app/.nextuid=0/ processuid=65532, matching the repro.Scope / notes
main(v0.47.9 → v0.47.10); isolates the fix from the unreleased 0.48–0.52 work ondevelop. The same fix is already ondevelopas 0.52.1.docker-compose.ymlmust (1) bump the image pin tov0.47.10(app + migrate), and (2) replace thecurlhealthcheck with the node-based one — Chainguard ships nocurl, so the current override marks the container unhealthy.🤖 Generated with Claude Code