Repository navigation
build: drop the unused sharp dependency so a failed binary download can't break the deploy - #230
Open
NitinKumar004 wants to merge 1 commit into
Open
NitinKumar004 wants to merge 1 commit into
NitinKumar004 wants to merge 1 commit into
Conversation
sharp is only Next's runtime image optimiser. The site is a static export with images.unoptimized, so nothing uses it, but every install still downloaded its prebuilt binary from GitHub releases and fell back to a node-gyp source build when that download failed. The Alpine builder has no Python, so one failed download broke the website stage pipeline (gofr-dev/gofr run 37425616104). Removes sharp and the 38 packages only it pulled in from package.json, yarn.lock and package-lock.json. No other entry changes.
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.
Why
The website stage pipeline failed on
development(gofr-dev/gofr run 37425616104), in the "Dockerize" job, atyarn install --frozen-lockfile:sharp@0.32.6downloads its native binary from GitHub releases on every install. When that download fails, it falls back to compiling with node-gyp, and thenode:24.19.0-alpine3.24builder has no Python. The binary does exist (sharp-v0.32.6-napi-v7-linuxmusl-x64.tar.gzreturns 200), and the same build passes from a clean cache onlinux/amd64, so this was a failed download. Any one failed download breaks the deploy, though, and the gofrdocs/Dockerfilestage runs a secondnpm installthat fetches it again.The site doesn't need sharp:
images: { unoptimized: true }(next.config.mjs), so Next's image optimiser, the thing sharp is for, never runs.src/imports it.Change
sharpfromdevDependencies.sharpand the 38 packages only it pulled in (prebuild-install,tar-fs,node-abi, ...) fromyarn.lockandpackage-lock.json. Both lockfiles lose the same 39 entries.yarn remove, because it also rewrote unrelated stale entries (algolia, typescript,@next/swc-*).Testing
I reproduced the full stage pipeline locally for
mainand for this branch, with Node 24, against gofrdevelopment(6e9bf3cd):yarn install --frozen-lockfile;llms-full,next build);docs/Dockerfileoverlay, includingAGENTS.md;npm install;npm run build, includingcheck-changelog.npm ci --dry-runalso accepts the editedpackage-lock.json.sharpinstalledout/.mdlastmoddiffer between any two builds)The only other differences are build noise: webpack chunk ids, where the two renamed chunks hold the same code, and the 8x8
blurDataURLthat Next computes for static image imports, which uses its built-in encoder instead of sharp. The site never setsplaceholder="blur", so that placeholder isn't rendered.next buildnow prints Next's "sharp is strongly recommended for production Image Optimization" warning. It refers to the runtime optimiser, which a static export doesn't have.