Hello! I use Pulumi to deploy a Lambda using `aws....
# general
Hello! I use Pulumi to deploy a Lambda using
However, my function requires a library that requires aws-sdk; When running my Lambda, it complains that jmespath is not installed (a dependency of aws-sdk); when I add it to my package.json, it then complains that xml2js is missing, so I guess it is a bad idea to add all awk-sdk's dependencies to my Pulumi project's package.json. So I am looking for a way for Pulumi to exclude my dependency's awk-code from the package. I understand I can pass a
object with a
attribute to
but I did not find docs about it and according to the code it takes an array of package names and aws-sdk is always added to it. So here is my question (thanks for reading all the context ;)) : What is the syntax I should use to exclude my dependency's awk-sdk? Thanks! 🙂
If I understand https://github.com/pulumi/pulumi/blob/master/sdk/nodejs/runtime/closure/codePaths.ts properly, there is no way to achieve what I need 🙄 If that's right, what workaround could help ? (without this, I'm blocked in a project as a lambda keeps failing because of this)
Simply adding
codePathOptions: { extraExcludePackages: ['awk-sdk'] }
doesn't change a thing
I use the other way to define functions, so things might be a bit different. However, aws-sdk should generally be a dev dependency, you don't need that once you deploy the lambda as it's available in the lambda environment, I'd put it on the dev Dependencies. We write typescript lambdas, so we use a package to copy node_modules over to the builds folder and deploy that. I am keen to hear what else people are doing to efficiently package and deploy lambdas
is our trick to copy the deps
it has options to avoid dev deps
actually the other way around, the default is to do not copy over dev deps, that makes sense
Thanks for your reply @damp-school-17708 🙂 I actually went the same way : I've moved aws-sdk as a devDep, so Pulumi stops embedding it in the lambda package (so we can use the aws-provided aws-sdk). This works fine for me so far. Out of curiosity: how to you integrate copy-node-modules with your pulumi code? you bypass all pulumi lambda packaging features and delegate everything to copy-node-modules?
what we do is use codebuild/codepipeline, so in the buidspec for that lambda project I run yarn install && yarn build, yarn build calls the npm package to copy over the node_modules
oh, ok, you manage CICD with Pulumi, but you deploy your Lambdas from your CICD. I may do this at some point.