gatsby-adapter-netlify went wrong installing the sharp module #39378
+2
−2
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.
Description
Fixed the Sharp module installation error in
gatsby-adapter-netlifywhen deploying to Netlify. The issue occurred because Sharp, a native Node.js module with platform-specific binaries, wasn't properly configured as an external module. This caused Netlify's bundler to incorrectly handle the Linux x64 binaries during function deployment.Changes:
sharpto theexternalNodeModulesarray in the Netlify function manifest configurationsharpin external modulesThis ensures Netlify's bundler treats Sharp as an external dependency and properly includes the platform-specific binaries for the Linux x64 environment, allowing Sharp to load the correct native module at runtime.
Documentation
No documentation changes required. This is an internal configuration fix that works transparently for users. The adapter will now handle Sharp correctly without any user-facing API changes.
Tests
src/__tests__/lambda-handler.tsto verify Sharp is included inexternalNodeModulesRelated Issues
Fixes #39377