diff --git a/CHANGELOG.md b/CHANGELOG.md index d93312172..ecff2b5eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ CHANGELOG - Fix a bug in the GitHub Actions program preventing errors from being rendered in the Actions log on github.com. [#3036](https://github.com/pulumi/pulumi/pull/3036) +- Fix a bug in the Node.JS SDK that caused failure details for provider functions to go unreported. + [#3048](https://github.com/pulumi/pulumi/pull/3048) + ## 0.17.28 (2019-08-05) - Retry renaming a temporary folder during plugin installation diff --git a/sdk/nodejs/runtime/invoke.ts b/sdk/nodejs/runtime/invoke.ts index 57e702065..19403c06a 100644 --- a/sdk/nodejs/runtime/invoke.ts +++ b/sdk/nodejs/runtime/invoke.ts @@ -83,7 +83,14 @@ export async function invoke(tok: string, props: Inputs, opts?: InvokeOptions): // If there were failures, propagate them. const failures: any = resp.getFailuresList(); if (failures && failures.length) { - throw new Error(`Invoke of '${tok}' failed: ${failures[0].reason} (${failures[0].property})`); + let reasons = ""; + for (let i = 0; i < failures.length; i++) { + if (reasons !== "") { + reasons += "; "; + } + reasons += `${failures[i].getReason()} (${failures[i].getProperty()})`; + } + throw new Error(`Invoke of '${tok}' failed: ${reasons}`); } // Finally propagate any other properties that were given to us as outputs.