Hi, I'm wondering if it is currently possible to u...
# typescript
e
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.
w
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
fetch
isn't available at the time of serialization.
g
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.
w
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 🙂
e
@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 :)