Hi, I dont understand how Pulumi does the dependen...
# general
f
Hi, I dont understand how Pulumi does the dependencies. For example, I am creating a Lambda in one typescript file. In another typescript file I am creating an API Gateway. In the API Gateway I have an Integration thats uses the lambdas ARN. I am exporting the lambda arn and importing in the api gateway file. Yet, when I run the code it says "TypeError: Cannot read properties of undefined (reading 'arn')". I was under the impression that Pulumi will recognize that the api gateway requires the lambda to be created first but since its undefined it doesnt look that way. I can also see in the logs that the lambda is not created yet. Note - I also tried the "dependsOn" with no luck. Does anybody understand whats going on here?
m
It sounds like the exported lambda reference is somehow undefined. It'd be hard to diagnose without seeing some code (because things do generally work as you describe). Any chance you could share something?
f
Untitled
Yeah! Lets see here I can provide some snippets:
Untitled
My assumption right now is this error is occurring because both files have import statements that call the other file
l
Correct. Cyclic imports in JS/TS code will lead to undefined outcome. To fix this, you will have to refactor your code so you have a unidirectional dependency chain.
f
Thank you!