You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there, hoping someone can shed some light on this issue.
I have only been dabbling with serverless functions for a couple of days but I find myself stuck, unable to move forward. Hopefully this isn't something silly on my part.
I am getting the following error after deploying my serverless function to AWS:
06:39:59 pm
2020-06-01T17:39:59.203Z 34bf19c1-4431-443d-977b-419a120053b2 ERROR { Error: Cannot find module 'sharp'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Module._require.o.require (/var/task/serverless_sdk/index.js:9:72748)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/task/webpack:/external "sharp":1:1)
at __webpack_require__ (/var/task/webpack:/webpack/bootstrap:19:1)
at Module.<anonymous> (/var/task/webpack:/Users/brendanbenoit/Personal/gaffty/image-resizing-microservice/sharp-demo/handler.js:1:15)
at __webpack_require__ (/var/task/webpack:/webpack/bootstrap:19:1)
at exports.getArg (/var/task/webpack:/webpack/bootstrap:83:1)
at Object.<anonymous> (/var/task/handler.js:87:10)
at Module._compile (internal/modules/cjs/loader.js:778:30) code: 'MODULE_NOT_FOUND' }
I looked around for a couple days now, trying to find the reason for this happening.
What I am doing is:
Create a new serverless project using serverless-nodejs-starter.
Update the serverless-* packages to their latest versions in package.json:
When I run the function locally, everything works as expected.
When I deploy and try to hit my endpoint via cURL, I am getting the above error message.
The only thing that seems to be making sense to me is that serverless-bundle excludes the sharp module by default, ass suggested in the generated serverless-state.json here:
Hmm the steps you are following seems right. The packager options is basically saying, don't use the installed version of sharp, install the one that works with Lambda.
One thing you can check to see if this works, is serverless package this generates a .serverless dir and you can look inside to see if sharp was packaged correctly. Give that a try?
Hey there, hoping someone can shed some light on this issue.
I have only been dabbling with serverless functions for a couple of days but I find myself stuck, unable to move forward. Hopefully this isn't something silly on my part.
I am getting the following error after deploying my serverless function to AWS:
I looked around for a couple days now, trying to find the reason for this happening.
What I am doing is:
serverless-nodejs-starter
.package.json
:serverless.yml
to make sure it gets added as a linux packageWhen I run the function locally, everything works as expected.
When I deploy and try to hit my endpoint via cURL, I am getting the above error message.
The only thing that seems to be making sense to me is that
serverless-bundle
excludes the sharp module by default, ass suggested in the generatedserverless-state.json
here:However that seems to be expected based on this comment.
I have also tried to
forceInclude
Sharp in my config but the issue remains the same.Any help figuring out why the module is not accessible once the app is deployed would be very much appreciated.
The text was updated successfully, but these errors were encountered: