尝试使用python AWS CDK创建空堆栈时返回JSII错误 [英] Returns JSII error when attempting to create empty stack with python AWS CDK

查看:85
本文介绍了尝试使用python AWS CDK创建空堆栈时返回JSII错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

aws cdk在空堆栈上返回jsii错误.复制的步骤是在hello世界级别上进行的,这使我认为我在某个地方存在版本不匹配的情况.我已经重新安装了aws cli,cdk和nodejs.对寻找什么有任何建议吗?

aws cdk returns jsii error on empty stack. Steps to reproduce are at the hello world level which makes me think that I have a version mismatch somewhere. I have re-installed aws cli, cdk and nodejs. Any suggestions on what to look for?

复制步骤:

mkdir myfolder
cdk init --language python
.env\Scripts\activate.ps1
python -m pip install -r requirements.txt
cdk synth

返回错误和一个空堆栈:

Returns error AND an empty stack:

(.env) p$[myfolder]> cdk synth                                                                                                                      d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13295
                    throw e;
                    ^

Error: EOF: end of file, read
    at Object.readSync (fs.js:592:3)
    at SyncStdio.readLine (d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13278:33)
    at InputOutput.read (d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13203:34)
    at KernelHost.run (d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13021:32)
    at Immediate.<anonymous> (d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13029:37)
    at processImmediate (internal/timers.js:461:21) {
  errno: -4095,
  syscall: 'read',
  code: 'EOF'
}
Resources:
  CDKMetadata:
    Type: AWS::CDK::Metadata
    Properties:
      Modules: aws-cdk=1.69.0,@aws-cdk/cloud-assembly-schema=1.69.0,@aws-cdk/core=1.69.0,@aws-cdk/cx-api=1.69.0,@aws-cdk/region-info=1.69.0,jsii-runtime=Python/3.7.4
    Metadata:
      aws:cdk:path: myfolder/CDKMetadata/Default
    Condition: CDKMetadataAvailable

环境

  - **CLI Version      :aws-cli/2.0.61 Python/3.7.7 Windows/10 exe/AMD64
  - **cdk Version:1.69.0 (build 2b474b9)
  - **Node.js Version:v14.15.0 
  - **OS               :Windows 10
  - **Language (Version):python 3.7.4  

我第一次在cdk上启动时看到此错误.但是,"cdk synth"显示了一个堆栈,因此我按下了.我什至能够"cdk部署"简单的堆栈.最终,由于代码变得稍微复杂一点,因此jsii错误阻止了堆栈的创建.我创建的代码会在我的机器上引发错误,但在其他机器上不会出错.来自其他开发人员的有效cdk代码不会在我的计算机上合成或部署堆栈.

Saw this error when I first started on cdk. But, 'cdk synth' showed a stack, so I pressed on. I was even able to 'cdk deploy' simple stacks. Eventually, as the code became only slightly more complex, jsii errors prevent stack creation. Code created by me throws errors on my machine but does NOT error on other machines. Working cdk code from other devs will not synth or deploy stacks on my machine.

到目前为止,我已经重新安装了aws cli,node.js和cdk.关于jsii错误的出处或如何解决的任何想法?

So far, I have re-installed aws cli, node.js and cdk. Any ideas where the jsii error originate or how to fix them?

推荐答案

对于Windows上的AWS-CDK,AWS CDK组记录了jsii中的至少一个错误.在jsiiruntime的深处(确切地说是13278行),aws cdk组有一个注释,并带有指向nodejs错误报告的链接.我向aws-cdk报告了我的问题,这似乎是相关的.他们复制了该错误,并在nodejs上创建了一个错误报告.该错误报告具有指向其他错误报告的链接. https://github.com/aws/aws-cdk/issues/11314

For AWS-CDK on Windows, there is at least one bug in jsii documented by AWS CDK group. Deep inside the jsiiruntime (line 13278 to be exact), aws cdk group has a comment with a link to a nodejs bug report. I reported my problem to aws-cdk which seemed to be related. They reproduced the bug and created a bug report at nodejs. This bug report has links to the other bug reports. https://github.com/aws/aws-cdk/issues/11314

但是我仍然需要一种解决方法.经过多次尝试和错误,以下两种变通办法应适用于Windows上的AWS-CDK.

But I still needed a workaround. After much trial and error, the following 2 workarounds should work for AWS-CDK on Windows.

解决方法1:用1.12或1.13版本取代站点程序包中的jsii 1.14.x版本.将1.14替换为1.12或1.13后,错误停止.获得发行版是一个把戏.您将必须从尚未升级或未运行pip的人那里得到一个-我就是这么做的.

Workaround 1: replace jsii 1.14.x distro in site-packages with 1.12 or 1.13 distro. After swapping out 1.14 for 1.12 or 1.13, errors stop. Getting a distro is a trick. You will have to get one from someone who has not upgraded or run pip -- which what I did.

解决方法2:将开发环境从Windows移到linux或mac

Workaround 2: move dev environment off Windows and onto linux or mac

这篇关于尝试使用python AWS CDK创建空堆栈时返回JSII错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆