terraform-cdk: Python cdktf get - Cannot find abortsignal

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave “+1” or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

cdktf & Language Versions

cdktf-cli: 0.7.0 Node: v14.17.0 Python: 3.8.5 Terraform: v1.0.9 OS: Windows 11

Affected Resource(s)

Debug Output

Running cdktf get in my project with the following cdktf.json file:

{
  "language": "python",
  "app": "python ./main.py",
  "terraformProviders": [
    "google@=3.88"
  ],
  "terraformModules": [],
  "codeMakerOutput": "imports",
  "context": {
    "excludeStackIdFromLogicalIds": "true",
    "allowSepCharsInLogicalIds": "true"
  }
}

I’m getting the following output:

 cdktf get
NOTE: Temp directory retained due to an error: C:\Users\danie\AppData\Local\Temp\temp-UsIzjn
Error: jsii compilation failed with non-zero exit code: 1
  | [2021-10-22T21:39:26.005] [ERROR] jsii/compiler - Compilation errors prevented the JSII assembly from being created
  | warning JSII6: A "peerDependency" on "constructs" at "10.0.9" means you should take a "devDependency" on "constructs" at "10.0.9" (found "undefined")"
  | warning JSII6: A "peerDependency" on "cdktf" at "0.7.0" means you should take a "devDependency" on "cdktf" at "0.7.0" (found "undefined")"
  | warning JSII3: There is no "README.md" file. It is required in order to generate valid PyPI (Python) packages.
  | node_modules/@types/node/child_process.d.ts:267:18 - error TS2304: Cannot find name 'AbortSignal'.
  |
  | 267         signal?: AbortSignal | undefined;
  |                      ~~~~~~~~~~~
  +----------------------------------------------------------------------------------
  | Command: C:\Users\danie\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\jsii\bin\jsii --silence-warnings reserved-word
  | Workdir: C:\Users\danie\AppData\Local\Temp\temp-UsIzjn
  +----------------------------------------------------------------------------------
    at newError (C:\Users\danie\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\@skorfmann\jsii-srcmak\lib\util.js:58:20)
    at ChildProcess.<anonymous> (C:\Users\danie\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\@skorfmann\jsii-srcmak\lib\util.js:75:29)
    at Object.onceWrapper (events.js:483:26)
    at ChildProcess.emit (events.js:376:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
⠦ downloading and generating modules and providers...
jsii compilation failed with non-zero exit code: 1
  | [2021-10-22T21:39:26.005] [ERROR] jsii/compiler - Compilation errors prevented the JSII assembly from being created
  | warning JSII6: A "peerDependency" on "constructs" at "10.0.9" means you should take a "devDependency" on "constructs" at "10.0.9" (found "undefined")"
  | warning JSII6: A "peerDependency" on "cdktf" at "0.7.0" means you should take a "devDependency" on "cdktf" at "0.7.0" (found "undefined")"
  | warning JSII3: There is no "README.md" file. It is required in order to generate valid PyPI (Python) packages.
  | node_modules/@types/node/child_process.d.ts:267:18 - error TS2304: Cannot find name 'AbortSignal'.
  |
  | 267         signal?: AbortSignal | undefined;
  |                      ~~~~~~~~~~~
  +----------------------------------------------------------------------------------
  | Command: C:\Users\danie\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\jsii\bin\jsii --silence-warnings reserved-word
  | Workdir: C:\Users\danie\AppData\Local\Temp\temp-UsIzjn
  +----------------------------------------------------------------------------------

Expected Behavior

Actual Behavior

Steps to Reproduce

Important Factoids

References

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 18 (3 by maintainers)

Most upvoted comments

Found a possible workaround (worked for me):

  1. cd to your cdktf-cli installation directory (It’s listed in the Command mentioned near the bottom of the error messages. Should contain npm\node_modules\cdktf-cli (stop once in cdktf-cli))
  2. Run npm install @types/node@14.17.27

Interesting I did try installing @types/node globally and that had no effect for me. I’ll give this a try tomorrow 🙂 unless @GnokGnik can confirm that works sooner

Found a possible workaround (worked for me):

  1. cd to your cdktf-cli installation directory (It’s listed in the Command mentioned near the bottom of the error messages. Should contain npm\node_modules\cdktf-cli (stop once in cdktf-cli))
  2. Run npm install @types/node@14.17.27

I’m also having the same issue. Terraform v1.0.9 Python 3.10.0 Node.js v14.18.1.

Has anybody found a workaround? tried what @drandell suggested with no luck. I’ve tried a number of things and it either hangs at downloading and generating modules (with no network activity) or throws the | 267 signal?: AbortSignal | undefined; exception.

This also happened to me, when i did cdktf get. It feels like nothing was happening and was “stuck” at downloading and generating modules. What i did was just to wait it out.

Now, it is my first time working on cdktf / terraform so im not sure if this “long wait” on cdktf get is normal or not.

@drandell Im currently studying terraform and I’m also stuck on this error. I attributed this error on me being a newbie on terraform (node js to be more precisse).

node_modules/@types/node/child_process.d.ts, from what i understand this file is using some codes ‘AbortSignal’ which it cannot resolve. I assume its due to dependencies (being outdated). Im new to nodejs/typescript and not sure how to resolve dependencies. (this is on the assumption that this is a dependency/versioning issue)

EDIT: Updated message Indeed this isn’t a terraform error but something under the hood with how cdktf uses jsii. I had only recently updated my cdktf from I believe 0.5 to 0.7 and my terraform version was 1.0.0 previously. Could be worth trying to install an older version of terraform and see if that helps (I would but not at my pc right now). I did try reverting to the older version 0.6.4 but also with the same result.

I’m also having the same issue. Terraform v1.0.9 Python 3.10.0 Node.js v14.18.1.

Glad its not just me, been trying to build some cdktf docker containers and I was completely baffled by this. I checked the temp directory created in the error and can confirm I don’t see any readme file (so the warnings seem all valid). I also updated to the latest LTS nodejs version like you and yup still the same error.