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.

(aws-cdk): Synth not working when testing against locally developed node modules patterns

See original GitHub issue

We have a situation where we develop a node package (call it package A) with cdk patterns we create for our company and then distribute them out to other teams to use. The problem we are running into is when we try to test our package locally (via npm link r yarn link) using a local package (call it package B) we run into Argument of type 'this' is not assignable to parameter of type 'Construct'. errors seeming to stem from the --prefer-ts-exts flag in the cdk.json. It looks like this flag is now added by default to the cdk.json file as of version 1.75.0. We are wondering if there is a way around these errors so we can develop and test our package (A) locally without running into this issue. We could remove the flag from the cdk.json but we would like to avoid that if possible, seeing that we will have to do this for each new project we create. We also get more weird behavior, and sometimes the error goes away, if we either remove or add specific packages (whether we actually consume them or not) to the package (B) we are using to test our patterns (from package A).

To clarify, we are creating package A, which contains the patterns we are developing. We then have a package B which consumes the patterns from package A to test them locally before releasing the package. When testing locally, we do a yarn/npm link from package B to A which then throws the above errors when we run a synth because package A has both .ts and .js files (since we are building it locally).

Environment

  • CDK CLI Version: 1.85.0 (build 5f44668)
  • Module Version: 1.83.0
  • Node.js Version: v14.15.1
  • OS: macOS Catalina
  • Language (Version): Typescript (~3.7.2)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
peterwoodworthcommented, Oct 27, 2021

Thank you very much @rcollette, this is likely the source of the issue originally posted

I’m sure people who hate this error will be happy when v2 is GA 😉

0reactions
github-actions[bot]commented, Oct 27, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

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.
Read more >
AWS CDK: Cannot find module 'typescript' - Stack Overflow
I have faced similar issue and my build was not working. However, my installing ts-node as global seems to solve the problem
Read more >
CDK tips, part 1 – how to use local CDK commands
I'm starting a new series with practical tips on working with the Cloud Development Kit. In part 1, I'll be talking about how...
Read more >
AWS CDK Pipelines: Real-World Tips and Tricks (Part 2)
Disclaimer: As the CDK development team extends the CDK libraries at a high pace and includes breaking changes, some of the details might...
Read more >
How to Install a local module using npm? - GeeksforGeeks
Local modules are modules created locally in your Node.js application to create user-required functionality. These local modules include ...
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