broad-translator-40115
06/15/2022, 9:00 AMaws.lambda.CallbackFunction
.
For some reason, Pulumi started deploying these functions included a big portion of node_modules
in the package, which deploys a package size of +15.5 MB (which is too big to use as a Lambda Edge.
I have tried stripping everything in the function and making sure to prevent any open closures, basically reducing it to callback: () => {}
.
No matter what I do, it keeps including node_modules
in the lambda package itself.
It used to worked perfectly, now I have zero idea what I suddenly did wrong to trigger this.
Any ideas how I can debug this, or how I can force-exclude node_modules
from the package?echoing-dinner-19531
06/15/2022, 12:21 PMbroad-translator-40115
06/15/2022, 1:34 PMechoing-dinner-19531
06/15/2022, 1:49 PMbroad-translator-40115
06/15/2022, 1:52 PMnode_modules
with what looks like all NodeJS inbuilts. These are already a part of the execution environments for lambdas, and should not be included.
I have no idea why this started to happen.
Any pointers? Is there any way I can control how Pulumi is building / treeshaking? (ala. webpack).echoing-dinner-19531
06/15/2022, 3:43 PM@pulumi/pulumi
)broad-translator-40115
06/15/2022, 3:46 PMwith({ variable })
which causing me issues with this.echoing-dinner-19531
06/15/2022, 3:49 PMUnfortunately, no luck with earlier versions, no.Shame that would of made things easier
Do you know of any way I can customize the serialization process?I don't, it's all black magic to me 😆 I'd suggest raising an issue at our github, can get one of the more "nodejs knowledgeable" team members to have a look.
broad-translator-40115
06/15/2022, 3:50 PMnode_modules
, and it doesn't seem like there's any way to add custom logic to this process 😞
https://www.pulumi.com/docs/intro/concepts/function-serialization/lambda.CallbackFunction
takes a codePathOptions.extraExcludePackages
field, and if I systemically add every single dependency here, it seems to work.
My guess is that the node bultins are included in some sub-dependency, and pulumi can't figure out to strip it under nested levels like this.
But at least, this works 👌