proud-art-41399
07/13/2024, 2:45 PM"use strict";
const pulumi = require("@pulumi/pulumi");
const aws = require("@pulumi/aws");
pulumi.runtime.registerStackTransformation((args) => {
pulumi.log.warn("dummy", args.resource);
return undefined;
});
const bucket = new aws.s3.BucketV2("mybucket");
However, when I do pulumi preview
(just to test it out), I get an error:
Previewing update (dev):
Type Name Plan Info
+ pulumi:pulumi:Stack test-js-dev create 1 error
Diagnostics:
pulumi:pulumi:Stack (test-js-dev):
error: Running program '/home/xxx/index.js' failed with an unhandled exception:
TypeError: Cannot read properties of undefined (reading 'promise')
at log (/home/xxx/node_modules/@pulumi/log/index.ts:103:48)
at Object.warn (/home/xxx/node_modules/@pulumi/log/index.ts:70:16)
at /home/xxx/index.js:6:14
at new Resource (/home/xxx/node_modules/@pulumi/resource.ts:410:26)
at new CustomResource (/home/xxx/node_modules/@pulumi/resource.ts:976:9)
at new BucketV2 (/home/xxx/node_modules/@pulumi/s3/bucketV2.ts:295:9)
at Object.<anonymous> (/home/xxx/index.js:10:16)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
at Module.load (node:internal/modules/cjs/loader:1206:32)
Am I doing anything wrong or should I consider this a bug? The same thing works in Python without a problem.little-cartoon-10569
07/14/2024, 8:48 PMreturn undefined
(which is technically wrong since that's a void function), your code is good. You could try using console.log
to see if the problem is in pulumi.log
, but I think that's unlikely.
What is on line 103 of index.ts? Is there an object called promise whose value is undefined?proud-art-41399
07/15/2024, 5:04 AMproud-art-41399
07/15/2024, 5:09 AMundefined
from the transformation function, see https://github.com/pulumi/pulumi/blob/master/sdk/nodejs/resource.ts#L776.little-cartoon-10569
07/15/2024, 10:29 AMlittle-cartoon-10569
07/15/2024, 10:31 AMproud-art-41399
07/15/2024, 11:02 AMundefined
actually can return is as per the link a provided. It can return ResourceTransformationResult | undefined
.little-cartoon-10569
07/15/2024, 7:36 PM* parents walking from the resource up to the stack.
. In my editor, the intellisense is showing only that it's a void function. Odd.little-cartoon-10569
07/15/2024, 7:40 PMproud-art-41399
07/15/2024, 7:46 PM