https://pulumi.com logo
#general
Title
# general
a

adventurous-jordan-10043

09/25/2018, 12:13 PM
Used the new
factoryFunc
of
aws.serverless.Function
. Not sure if the global approach is the best but it’s really cool to have that
w

white-balloon-205

09/25/2018, 1:20 PM
Curious what your concern is on this? It's morally the equivalent of what's normally done in Lambda/etc. where a module is loaded which is expected to export a function. This allows ammortizing startup costs (loading and initializing Express, connecting to DBs, etc.) across multiple sequentials executions of the function - which can have significant performance implications.
a

adventurous-jordan-10043

09/25/2018, 1:20 PM
yes this is exactly why I use it
but the whole factory thing is not the classic approach you see all the time in examples
where code that needs to run only once per container init is outside the handler
but it works really i’m just nitpicking
w

white-balloon-205

09/25/2018, 1:23 PM
Got it - yes - it's definitely a little different style (required because Pulumi allows mixing deployment and runtime code). Though note that you can write in that style by just having a separate file and then loading it inside the
factoryFunc
.
a

adventurous-jordan-10043

09/25/2018, 1:24 PM
yeah sure this is what I ended up with
but I’ve discovered what you’ve done for iopipe integration and that’s giving me a lot more ideas
w

white-balloon-205

09/25/2018, 1:28 PM
🙂. That's clearly a little bit of a "hack" - and we'd love to support this style of thing in a more first-class way - but it works well in practice given how flexible JavaScript is with this sort of monkey-patching.
a

adventurous-jordan-10043

09/25/2018, 1:29 PM
I want to PR a small thing that should improve a little bit the iopipe integration (and the possible epsagon one I’m making)
but I’m not sure it will be good
we’ll see
w

white-balloon-205

09/25/2018, 2:06 PM
PR welcome! (and btw - I was planning on doing an Epsagon one very similar to the IOPipe one - but if you have something in progress, happy to build on top of that!)
a

adventurous-jordan-10043

09/25/2018, 2:07 PM
Will do, and glad to add it to pulumi org if it is good enough
g

great-oyster-55563

09/26/2018, 2:24 AM
This is awesome! I know @astonishing-appointment-61804 is interested in this work as well for IOpipe.
a

astonishing-appointment-61804

09/27/2018, 6:50 PM
Yes I am still working on my PR
w

white-balloon-205

09/27/2018, 7:32 PM
Looking forward to it! Let us know if we can help. We made some updates to improve reliability that merged this morning in https://github.com/pulumi/pulumi-iopipe/pull/2. Thanks @adventurous-jordan-10043 for the help on that.