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.

[bug] `integ:*:watch` doesn't work out of the box for `AwsCdkConstructLibrary`

See original GitHub issue

When using awscdk.AwsCdkConstructLibrary, after adding an integration test and running yarn:foobar:watch, I get the following error message:

josh@josh-XPS-15-9550:~/proj/test-a$ yarn integ:foobar:watch
yarn run v1.22.17
$ npx projen integ:foobar:watch
👾 integ:foobar:watch | cdk watch --app "ts-node -P tsconfig.dev.json test/foobar.integ.ts" --no-version-reporting -o test/.tmp/foobar.integ/deploy.cdk.out
Cannot use the 'watch' command without specifying at least one directory to monitor. Make sure to add a "watch" key to your cdk.json
👾 Task "integ:foobar:watch" failed when executing "cdk watch --app "ts-node -P tsconfig.dev.json test/foobar.integ.ts" --no-version-reporting -o test/.tmp/foobar.integ/deploy.cdk.out" (cwd: /home/josh/proj/test-a)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I can get the watch command to work when I put cdk.json file like this in my project root:

{
  "watch": {
    "include": [
      "src/**/*.ts",
      "test/**/*.integ.ts",
      "assets/**"
    ]
  }
}

Projen should probably create this file by default.

Here’s an SSCCE: https://github.com/misterjoshua/projen-integ-deploy-bug-cdkv2

To reproduce in the SSCCE run these commands:

yarn
yarn integ:foobar:watch

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
moltarcommented, Sep 15, 2022

My “proper” fix 😁

const cdkConfig = new CdkConfig(project, {
  app: '', // Required for types.
  watchIncludes: [
    `${project.srcdir}/**/*.ts`,
    `${project.testdir}/**/*.integ.ts`,
  ],
});
cdkConfig.json.addDeletionOverride('app');
cdkConfig.json.addDeletionOverride('context');
cdkConfig.json.addDeletionOverride('output');
0reactions
misterjoshuacommented, Feb 21, 2022

@Chriscbr Ah! Thanks for noticing. Yes, I’m still having this issue. I saw the stale notification and forgot to add a comment in time. Sorry about that. Yes, please re-open. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting common AWS CDK issues
This topic describes how to troubleshoot the following issues with the AWS CDK. After updating the AWS CDK, the AWS CDK Toolkit (CLI)...
Read more >
Troubleshooting common AWS CDK issues
This topic describes how to troubleshoot the following issues with the AWS CDK. ... Errors in code that used to work is typically...
Read more >
Constructs - AWS Cloud Development Kit (AWS CDK) v2
The AWS CDK includes a collection of constructs called the AWS Construct Library, containing constructs for every AWS service. Construct Hub is a...
Read more >
Working with the AWS Cloud Development Kit and AWS ...
The AWS CDK includes the AWS Construct Library, a broad set of modules that expose APIs for defining AWS resources in CDK applications....
Read more >
Feature flags - AWS Cloud Development Kit (AWS CDK) v2
This is the AWS CDK v2 Developer Guide. The older CDK v1 entered maintenance on June 1, 2022 and will now receive only...
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