Skip to content

Conversation

@anya-xcode
Copy link

Description

Fixed the Sharp module installation error in gatsby-adapter-netlify when 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:

  • Added sharp to the externalNodeModules array in the Netlify function manifest configuration
  • Updated corresponding test expectations to include sharp in external modules

This 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

  • Updated existing unit test in src/__tests__/lambda-handler.ts to verify Sharp is included in externalNodeModules
  • Tested locally by verifying the function manifest configuration includes Sharp in the external modules array
  • The fix has been validated to address the root cause of the deployment failure

Related Issues

Fixes #39377

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gatsby-adapter-netlify went wrong installing the "sharp" module

1 participant