aws-cdk: [cdk-pipelines] unable to determine cloud assembly output directory. Assets must be defined indirectly within a "Stage" or an "App" scope .
When attempting to implement the cdk pipeline example found in this blog post, several of us have gotten the error unable to determine cloud assembly output directory. Assets must be defined indirectly within a “Stage” or an “App” scope . once the addApplicationStage step is added to the code.
import { CdkpipelinesDemoStage } from './cdkpipelines-demo-stage';
// ...
// This is where we add the application stages
pipeline.addApplicationStage(new CdkpipelinesDemoStage(this, 'PreProd', {
env: { account: 'ACCOUNT1', region: 'us-east-2' }
}));
The Question
What is the meaning of this error ? It isn’t clear at all what one should do to solve it.
Environment
-
CDK CLI Version: 1.57
-
Language: TypeScript
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 18 (2 by maintainers)
Based on experimentation, we determined this error is due to their being a subtle difference in the list of cdk packages in the package json. Specifically we had aws-cdk/core set to “1.57.0” whereas the other aws-cdk pacakges being used were set to version “^1.57.0”. Correcting this mismatch, deleting the node_modules and the package.lock.json, and performing a new npm install fixed the issue. I would say though that the error message here isn’t all that helpful, and may be misleading.
This worked for me (on my local machine):
node_modulesandpackage-lock.json(alternatively I’d thinknpm ciwould do the same)npm icdk synthto verify. This yielded an actual error in my λ definition. Since I’d shuffled directories around for tidiness, I’d neglected to adjust the path to my λ code (an error which didn’t surface before steps 1 & 2)Pipeline “build” step (synth) happy again!
I just did 1.62.0 to 1.63.0 before updating I removed the cdk.out folder and the lock file. I did not delete the module files. It seemed to work with that method.
me too; To fix… corrected a couple of packages from 1.61.0 to 1.61.1 but that didn’t fix the issue; removed the package-lock.json; removed node_modules recursively and forcefully; reinstall node packages; then, I changed command from “cdk deploy” to “cdk deploy CdkpipelinesDemoPipelineStack”; and, it worked!