Skip to content

Issue with Sharp Library #57

Description

@vivrkerror404

Hi,

I am facing an issue with this module when I tried to minify the sharp - npm bundle in node.js & deployed it on serverless then I got the below error:

But without serverless-plugin-browserifier it is working fine on serverless

INIT_START Runtime Version: nodejs:18.v31 Runtime Version ARN: arn:aws:lambda:ap-south-1::runtime:8ece8834b939ff191c80d2c2482efff16a57464e3894a1ef66c15edae5018028 2024-08-11 17:21:42.378 ERROR Uncaught Exception {"errorType":"Error","errorMessage":"Could not load the \"sharp\" module using the linux-x64 runtime\nPossible solutions:\n- Ensure optional dependencies can be installed:\n npm install --include=optional sharp\n yarn add sharp --ignore-engines\n- Ensure your package manager supports multi-platform installation:\n See https://sharp.pixelplumbing.com/install#cross-platform\n- Add platform-specific dependencies:\n npm install --os=linux --cpu=x64 sharp\n- Consult the installation documentation:\n See https://sharp.pixelplumbing.com/install","stack":["Error: Could not load the \"sharp\" module using the linux-x64 runtime","Possible solutions:","- Ensure optional dependencies can be installed:"," npm install --include=optional sharp"," yarn add sharp --ignore-engines","- Ensure your package manager supports multi-platform installation:"," See https://sharp.pixelplumbing.com/install#cross-platform","- Add platform-specific dependencies:"," npm install --os=linux --cpu=x64 sharp","- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"," at 179../libvips (/var/task/index.js:39563:9)"," at o (/var/task/index.js:1:631)"," at /var/task/index.js:1:682"," at 171../is (/var/task/index.js:34857:1)"," at o (/var/task/index.js:1:631)"," at /var/task/index.js:1:682"," at 172../channel (/var/task/index.js:35305:15)"," at o (/var/task/index.js:1:631)"," at /var/task/index.js:1:682"," at 1.express (/var/task/index.js:5:15)"]} INIT_REPORT Init Duration: 221.84 ms Phase: init Status: error Error Type: Runtime.Unknown

here is the browserifier configuration in serverless.yml file

`
plugins:

  • serverless-plugin-browserifier

custom:
browserifier:
external:
- sharp

package:
excludeDevDependencies: true
individually: true
include:
- 'node_modules/sharp/**'`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions