Hej everyone! Using Typescript, how would I go abo...
# aws
Hej everyone! Using Typescript, how would I go about using pulumi-specific types in Lambda functions? Naively importing them in the same way you would with custom defined types results in the
Cannot find module '@pulumi/pulumi/runtime/index.js'
error, I guess because
packages are not included in the Lambda. Any way around this?
Short of installing Pulumi in the lambda, no. What types do you want to use in a lambda? There may be a different way to achieve your goals.
I'm passing a TopicEvent to a Lambda function to process it further. There are workarounds (
e.g.), but it'd be nice to keep the proper types, if at all possible
The event arrives in the lambda as a JSON payload, I believe? There's a class in the AWS SDK you could use, but since it's not a Pulumi object, there's no need to bring Pulumi into the equation, I think?
Ah I see the TopicEvent/TopicRecord stuff in the mixins. I guess you could copy that code, it's pretty lightweight. But using the SDK equivalents is probably best.
Copying the code is what I've went with for now, but thanks for the hint, will look for the SDK versions : )
👍 1
If you are just using the types, this should work just fine, as they are only used at TypeScript build time. Can you perhaps share a snippet of the code you are using inside your CallbackFunction, and how you are using
Checked again and you are right! The issue was passing a parameter with
without storing it as an intermediary variable.
👍 1