question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[cdk-pipelines] unable to determine cloud assembly output directory. Assets must be defined indirectly within a "Stage" or an "App" scope .

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

32reactions
billmcknight1953commented, Aug 12, 2020

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.

7reactions
colvintcommented, Nov 7, 2020

This worked for me (on my local machine):

  1. Delete node_modules and package-lock.json (alternatively I’d think npm ci would do the same)
  2. npm i
  3. cdk synth to 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)
  4. Fixed the error, commit and push

Pipeline “build” step (synth) happy again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

awslabs/aws-cdk - Gitter
unable to determine cloud assembly output directory. Assets must be defined indirectly within a "Stage" or an "App" scope.
Read more >
Stage — AWS Cloud Development Kit 1.184.0 documentation
scope ( Construct ) – ... Stacks defined inside this Stage with either region or account missing from its env ... The cloud...
Read more >
awscdk - Go Packages
Version 2 of the AWS Cloud Development Kit library. ... CfnElements must be defined within a stack scope (directly or indirectly).
Read more >
How to Define Cloud Infrastructure with the AWS Cloud ...
The AWS Cloud Development Kit (CDK) is an open-source software development framework to define your cloud application resources using ...
Read more >
AWS CDK Pipeline: Assets stage fails to find buildSpec ...
Self-mutation has to be enabled - currently, asset updates mutate the pipeline. Reference: https://github.com/aws/aws-cdk/issues/9080.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found