-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
guidanceQuestion that needs advice or information.Question that needs advice or information.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.
Description
❓ General Issue
The Question
Is it possible to do asynchronous processing in a Construct? Is there anything in CDK that will wait for a promise to resolve? It seems that everything is synchronous.
I need to resolve a string value to a path, but it could take some time so implemented it asynchronously.
Options considered:
Aspects
The visit method is synchronous.
Tokens
The resolve method is synchronous.
Create the app asynchronously
async function createApp(): Promise<App> {
const result = await asyncProcessing();
const app: App = new App();
// pass result to every stack, bit ugly
return app;
}
Context
The same as before, but put result into the context, so don't have to pass it to every stack/construct. Honestly, I don't really like this solution, because the construct is reaching out to some known location to get a value. Like process.env
calls that are scattered throughout the code.
Is there any support in CDK for asynchronous processing? Or is it an anti-pattern and I'm doing the wrong way?
Environment
- CDK CLI Version: 1.39.0
- Module Version:
- OS: Windows 10
- Language: TypeScript
Other information
mrgrain, damnhandy, austin-payne, thundo, eli-lim and 16 more
Metadata
Metadata
Assignees
Labels
guidanceQuestion that needs advice or information.Question that needs advice or information.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.