Hi, I'm wondering if it is currently possible to use the fetch api inside Lambda functions that are serialized by Pulumi? Compilation fails with a message that fetch is undefined. I've set the runtime to node 18.
05/18/2023, 11:23 AM
Hi James! Are you running Pulumi from an environment with Node 18? This could be a bug in Pulumi's Node serialization code, or it could be that
isn't available at the time of serialization.
05/18/2023, 5:05 PM
We've hit many of these bugs in our workspace setup so we decided to abandon serialized lambdas entirely and instead we build them in a separate project and then just use it as an Asset.
One of the problems was that dependency was in the workspace package and pulumi runtime could not simply serialize for whatever reason.
05/18/2023, 5:23 PM
Ah, yeah, I'm not surprised there's issue with workspace support. My colleague was looking at Yarn Workspace support this past week; I think serialization is still tricky, but he otherwise found Yarn Workspaces worked as expected. if you have evidence to the contrary, we'd love to see it 🙂
05/30/2023, 4:02 AM
@worried-rain-74420 fetch is a provided module in Node 18 - probably too new at this stage for the serialization handler to recognise that. @great-sunset-355 I did the same thing and it works fine. The other issue with lambda serialization is that all non-Pulumi dependencies get included in the bundle so using a separate project per lambda fixes that issue as well.
Thanks for the responses :)