-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expected outputs are not produced when using an async main function in Node #2910
Comments
Current versions:
|
Occurs with these versions too if helpful:
|
A simple workaround is:
It is mostly unintentional that this does not work as written - if your module export is itself a Promise or Output, we should be able to handle that (just like we handle if it is an object with Promise or Output-valued properties). |
Fix available. |
Thanks for the snippet @lukehoban :) it worked for me Is there a way to export multiple stack outputs? |
Absolutely! Just do this: const mainResult = main();
export const bucketArn = mainResult then(m => m.bucketArn);
export const whatever = mainResult.then(m => yadda yadda);
export const whatever2 = 1 + 2 + floop; basically, all your top-level exports become 'stack outputs'. You can have those be outputs, promises, expressions, whatever. :) |
^^^ Is it a guaranteed behavior to export promise and get the resolved value at the end? |
Yes - the Pulumi JavaScript SDK will load your entrypoint module, then resolve all Inputs (Outputs or Promises) that were set on the modules exports. This is required and guaranteed behavior. |
I was bitten by this issue today and, as far as I understand, the docs seem to indicate that exporting an async function would work. Am I missing something? |
I would expect the following program to produce an output name
bucketArn
with the value from the resource, however it produces no outputs.The text was updated successfully, but these errors were encountered: