<@UB3BGTV63> Question related to the import errors...
# typescript
d
@white-balloon-205 Question related to the import errors seen in https://pulumi-community.slack.com/archives/CJ909TL6P/p1592523846362500... We're building our lambdas using
CallbackFunction
in order to take advantage of the automatic serialization (https://www.pulumi.com/docs/tutorials/aws/serializing-functions/). This works fine in most cases but starts to break down when we put resources in different modules. I have repository
A
that contains my pulumi stack and resources, and a repository
B
that contains shared pulumi
Component
s and typescript helper functions in sub-modules. If I create a
CallbackFunction
in
A
that uses a sub-module from
B
, I run into `ImportModuleError`s, even if that sub-module in
B
doesn't directly include any references to
@pulumi/*
modules. It appears the serialization pulls in the entire
B
module, rather than just the needed sub-module, causing the lambda to try to import erroneous pulumi libraries. Situations like this seem to be correctly handled when all of the dependencies are in
A
, but the serializer gets tripped up when a dependent module itself has pulumi dependencies. Is this a potential bug in the serializer, or should I be using a different pattern to avoid this (split modules so they don't share pulumi code with vanilla lambda helpers)? Is there a way to ask the serializer to be more aggressive about inlining dependent code? Thanks. cc @worried-engineer-33884
w
Situations like this seem to be correctly handled when all of the dependencies are in 
A
, but the serializer gets tripped up when a dependent module itself has pulumi dependencies.
Interesting - and thanks for the details - it is certainly possible there is a bug here. Any chance you have a repro of this? Or have you opened a GitHub issue yet? Sounds like something we'll need to reproduce and diagnose in more depth.
d
Thanks. I'll write a small example and open a Github issue. Just wanted to touch base here first.
👍 1