This message was deleted.
# typescript
s
This message was deleted.
m
the only function that was serialized was the one passed directly to
CallbackFunction
but all functions it referenced were not serialized
^ that's basically the constructor that assigns a member function to the Callback Function
i figured out a workaround; you've gotta create a service object with the functions you want to use in the callback, instantiate it, and then pass it to
aws.lambda.CallbackFunction
as an arrow function w/ the service object instance caught in the closure
idk if that would be easy for others to figure out, took me a while
m
That’s interesting — I would’ve found this surprising, too. Glad you found a way through it. I wonder if there’s something about
webhookCallback
specifically that got in the way somehow, because this, at least for me, seems to work:
and with a
lambda.CallbackFunction
, I also see
someFunc
serialized into the Lambda:
… so I wonder what happened there. 🤔
m
yeah. also curious. it was using
this.someFunc
, it was another member function of the instance
m
aha, so you saw something like this?
m
yes, exactly
m
nice, ok. seems like this is either a bug or something that needs to be documented — will report back!
m
lmk!
m
Ended up filing this, as I think it may be a bug — or at least need better documentation! https://github.com/pulumi/pulumi/issues/9168
m
yeah, i wonder if it's possible to serialize in that situation at all. i believe the "instance" or object created from the object prototype exists at the time that the function assignment occurs, but i'm not sure it's simply a matter of capturing everything in the closure and i'm not sure how you would make the serializer aware a particular closure was a "constructor" (since it's syntax sugar/ it's really just another function)