echoing-kite-20691
08/22/2024, 4:05 PMminiature-musician-31262
08/22/2024, 4:21 PMaws-typescript
project (based on the doc you linked), and it seems to work for me:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
export = async () => {
const bucket = new aws.s3.Bucket("my-bucket");
return {
bucketName: bucket.id,
};
}
Output:
➜ pulumi up
Previewing update (dev)
Type Name Plan
+ pulumi:pulumi:Stack aws-typescript-cfe895a-dev create
+ └─ aws:s3:Bucket my-bucket create
Outputs:
bucketName: output<string>
Resources:
+ 2 to create
Does your code look different?miniature-musician-31262
08/22/2024, 4:25 PMreturn
object is optional by the way -- they docs don't make this super clear (we'll fix that)echoing-kite-20691
08/22/2024, 5:52 PMexport default
instead. I'm not familiar with the export =
syntax.echoing-kite-20691
08/22/2024, 5:53 PMtsserver
:echoing-kite-20691
08/22/2024, 5:54 PMexport =
is commonjs vs export default
being esm?miniature-musician-31262
08/22/2024, 6:23 PMexport =
is a TypeScript thing for use with CommonJS. It's essentially like saying module.exports = { your: stuff }
(and indeed compiles to that in JS).
https://www.typescriptlang.org/docs/handbook/modules/reference.html#export--and-import--requireechoing-kite-20691
08/22/2024, 6:38 PMminiature-musician-31262
08/22/2024, 6:40 PMtsconfig.json
and make sure it's not "type": "module"
-- that could be it.echoing-kite-20691
08/23/2024, 1:40 PMexport =
, I noticed the following message when a stack update fails:
error: update failed
The Pulumi runtime detected that 171 promises were still active
at the time that the process exited. There are a few ways that this can occur:
* Not using `await` or `.then` on a Promise returned from a Pulumi API
* Introducing a cyclic dependency between two Pulumi Resources
* A bug in the Pulumi Runtime
Leaving promises active is probably not what you want. If you are unsure about
why you are seeing this message, re-run your program with the `PULUMI_DEBUG_PROMISE_LEAKS`
environment variable. The Pulumi runtime will then print out additional
debug information about the leaked promises.
I wonder if this is due to the fact I'm exporting an async function or maybe it has to do with the usage of promises as inputs to other resources.