From 93743733fb71cc22f27c02b675dff6847f365db1 Mon Sep 17 00:00:00 2001 From: joeduffy Date: Wed, 6 Sep 2017 14:51:00 -0700 Subject: [PATCH] Explicitly serialize output properties in closures --- sdk/nodejs/runtime/closure.ts | 4 ++++ sdk/nodejs/runtime/resource.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/sdk/nodejs/runtime/closure.ts b/sdk/nodejs/runtime/closure.ts index 400bc3225..a2e52e963 100644 --- a/sdk/nodejs/runtime/closure.ts +++ b/sdk/nodejs/runtime/closure.ts @@ -97,6 +97,10 @@ async function serializeCapturedObject(obj: any): Promise { // If this is a promise, we will await it and serialize the result instead. return serializeCapturedObject(await obj); } + else if (obj instanceof Property) { + // If this is a property, explicitly await its output promise so that we get the raw value. + return serializeCapturedObject(await obj.outputPromise); + } else if ((obj as Computed).mapValue) { // If this is a computed value -- including a captured fabric resource property -- mapValue it. return await new Promise((resolve) => { diff --git a/sdk/nodejs/runtime/resource.ts b/sdk/nodejs/runtime/resource.ts index 6741aab83..fc0a27948 100644 --- a/sdk/nodejs/runtime/resource.ts +++ b/sdk/nodejs/runtime/resource.ts @@ -37,6 +37,7 @@ export function registerResource( // Fetch the monitor; if it doesn't exist, bail right away. if (!monitor) { + Log.debug(`Not sending RPC to monitor -- it doesn't exist: t=${t}, name=${name}`); return; }