https://pulumi.com logo
#general
Title
# general
j

jolly-lifeguard-22556

10/08/2018, 3:21 PM
When you
pulumi up
on a js/ts project using cloud.HttpServer does it just zip up your local node_modules folder and upload to Lambda? I've tried all kinds of combinations of how I actually build the sharp module. I'm running Ubuntu locally so I think that it should be compatible with Lambda anyways but also tried using docker builds as described here: http://sharp.pixelplumbing.com/en/stable/install/#aws-lambda
w

white-balloon-205

10/08/2018, 3:25 PM
More or less yes - your local
node_modules
is uploaded as part of the Lambda. That does mean that if you are using native Node modules, you’ll need to install Node modules in a sufficiently compatible Linux environment - ideally an Amazon Linux docker image.
j

jolly-lifeguard-22556

10/08/2018, 3:28 PM
Hmmm that sucks I've already tried with the official lambda build container and still can't get the module to load correctly
Will keep poking around
w

white-balloon-205

10/08/2018, 3:39 PM
Curious - what error do you see?
j

jolly-lifeguard-22556

10/08/2018, 3:51 PM
It always ends up with:
Copy code
module initialization error: Error
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/task/node_modules/sharp/lib/constructor.js:10:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
Which from the googling I've done seems typical of situations where an incompatible version of sharp is trying to be loaded into the Lambda environment 😞
w

white-balloon-205

10/08/2018, 4:19 PM
Cc @lemon-spoon-91807 in case he has any additional thoughts.
l

lemon-spoon-91807

10/08/2018, 4:22 PM
that's definitely tricky. one possibility i can think of (not knowing node super-well) would be that it might be possible if you could somehow install both versions of "sharp" locally, then explicitly pass arguments to Lambda creation to skip the package relevant to your local env, and upload the package relevant to the foreign env.