Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java aws-cdk: Cdk App class initialization/constructor started to fail on Windows 10 and 11 #26632

Closed
LukasSmrcka opened this issue Aug 4, 2023 · 14 comments
Assignees
Labels
bug This issue is a bug. effort/medium Medium work item – several days of effort p2 package/tools Related to AWS CDK Tools or CLI

Comments

@LukasSmrcka
Copy link

Describe the bug

Two days ago all CDK projects we have started to fail on constructor of App class. One of these projects was working before and was not even touched, no node updates, no cli updates. It is happening only on Windows 10,11 ... multiple people started to face the issue at the same time. We tried to migrate project on Ubuntu and it was working as expected. We tried to create a new CDK template project from scratch on Windows and the same issue. We suspect it was some Windows update causing this. Here is the callstack that is same everywhere:

software.amazon.jsii.JsiiError: EPERM: operation not permitted, symlink 'C:\Users\annonymous\AppData\Local\AWS\jsii\package-cache\constructs\10.2.69\999a045971105d00548e478f26ed34c78a3f59c8d2761e5b10ff99bb9
6d18043' -> 'C:\Users\annonymous\AppData\Local\Temp\jsii-kernel-c704Aa\node_modules\constructs'
Error: EPERM: operation not permitted, symlink 'C:\Users\annonymous\AppData\Local\AWS\jsii\package-cache\constructs\10.2.69\999a045971105d00548e478f26ed34c78a3f59c8d2761e5b10ff99bb96d18043' -> 'C:\Users\annonymous\AppData\Local\Temp\jsii-
kernel-c704Aa\node_modules\constructs'
at symlinkSync (node:fs:1816:3)
at link (C:\Users\annonymous\AppData\Local\Temp\jsii-java-runtime7523181351169875103\lib\program.js:10445:38)
at extractViaCache (C:\Users\annonymous\AppData\Local\Temp\jsii-java-runtime7523181351169875103\lib\program.js:11493:29)
at Object.extract (C:\Users\annonymous\AppData\Local\Temp\jsii-java-runtime7523181351169875103\lib\program.js:11450:81)
at C:\Users\annonymous\AppData\Local\Temp\jsii-java-runtime7523181351169875103\lib\program.js:9916:127
at Kernel._Kernel_debugTime (C:\Users\annonymous\AppData\Local\Temp\jsii-java-runtime7523181351169875103\lib\program.js:10365:24)
at Kernel._Kernel_load (C:\Users\annonymous\AppData\Local\Temp\jsii-java-runtime7523181351169875103\lib\program.js:9916:105)
at C:\Users\annonymous\AppData\Local\Temp\jsii-java-runtime7523181351169875103\lib\program.js:9653:181
at Kernel._Kernel_debugTime (C:\Users\annonymous\AppData\Local\Temp\jsii-java-runtime7523181351169875103\lib\program.js:10365:24)
at Kernel.load (C:\Users\annonymous\AppData\Local\Temp\jsii-java-runtime7523181351169875103\lib\program.js:9653:96)
at software.amazon.jsii.JsiiRuntime.processErrorResponse(JsiiRuntime.java:150)
at software.amazon.jsii.JsiiRuntime.requestResponse(JsiiRuntime.java:116)
at software.amazon.jsii.JsiiClient.loadModule(JsiiClient.java:56)
at software.amazon.jsii.JsiiEngine.loadModule(JsiiEngine.java:188)
at software.amazon.jsii.JsiiEngine.loadModule(JsiiEngine.java:185)
at software.amazon.jsii.JsiiEngine.createNewObject(JsiiEngine.java:608)
at software.amazon.awscdk.App.(App.java:86)
at cz.acrobits.cdk.conferencing_chime.CdkApp.main(CdkApp.java:40)

Expected Behavior

It is possible to create an instance of App.class

Current Behavior

It is not possible to create an instance of App.class

Reproduction Steps

Take Windows 10 or 11. Install all updates. Init a brand new project in java using cli and run it

Possible Solution

It looks like some permission issue so I would try to run the node.js command from java under admin user as a first steo to verify

Additional Information/Context

No response

CDK CLI Version

2.88.0, 2.89.0

Framework Version

2.89.0

Node.js Version

18.17.0 , 20.5.0

OS

Windows 10,11

Language

Java

Language Version

java 11

Other information

No response

@LukasSmrcka LukasSmrcka added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 4, 2023
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Aug 4, 2023
@pahud
Copy link
Contributor

pahud commented Aug 4, 2023

This sounds like related to Windows update. I am making it a p2 here before we have more insights. Please help us prioritize with upvotes.

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Aug 4, 2023
@Scrat94
Copy link

Scrat94 commented Aug 6, 2023

I am also facing this issue within a python cdk project.
The strange thing I observed, in one of my old python project with a virtual environment, it is still working fine, but as soon as I reinstall the virutal environemtn (still with all the same version, e.g. aws-cdk-lib 2.42.1), its causing the exact same error as above. So I am not sure whether this is a related to a windows update or not.

This is my error:

jsii.errors.JavaScriptError: 
  Error: EPERM: operation not permitted, symlink 'C:\Users\anonymous\AppData\Local\AWS\jsii\package-cache\constructs\10.2.69\999a045971105d00548e478f26ed34c78a3f59c8d2761e5b10ff99bb96d18043' -> 'C:\Users\anonymous\AppData\Local\Temp\jsii-kernel-wBjjZK\node_modules\constructs'
      at symlinkSync (node:fs:1816:3)
      at link (C:\Users\anonymous\AppData\Local\Temp\tmpmt7e1jwn\lib\program.js:10445:38)
      at extractViaCache (C:\Users\anonymous\AppData\Local\Temp\tmpmt7e1jwn\lib\program.js:11493:29)
      at Object.extract (C:\Users\anonymous\AppData\Local\Temp\tmpmt7e1jwn\lib\program.js:11450:81)
      at C:\Users\anonymous\AppData\Local\Temp\tmpmt7e1jwn\lib\program.js:9916:127
      at Kernel._Kernel_debugTime (C:\Users\anonymous\AppData\Local\Temp\tmpmt7e1jwn\lib\program.js:10365:24)
      at Kernel._Kernel_load (C:\Users\anonymous\AppData\Local\Temp\tmpmt7e1jwn\lib\program.js:9916:105)
      at C:\Users\anonymous\AppData\Local\Temp\tmpmt7e1jwn\lib\program.js:9653:181
      at Kernel._Kernel_debugTime (C:\Users\anonymous\AppData\Local\Temp\tmpmt7e1jwn\lib\program.js:10365:24)
      at Kernel.load (C:\Users\anonymous\AppData\Local\Temp\tmpmt7e1jwn\lib\program.js:9653:96)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Temp\test-project\app.py", line 2, in <module>
    import aws_cdk as cdk
  File "C:\Temp\test-project\.venv\lib\site-packages\aws_cdk\__init__.py", line 1132, in <module>
    from ._jsii import *
  File "C:\Temp\test-project\.venv\lib\site-packages\aws_cdk\_jsii\__init__.py", line 13, in <module>
    import constructs._jsii
  File "C:\Temp\test-project\.venv\lib\site-packages\constructs\__init__.py", line 43, in <module>
    from ._jsii import *
  File "C:\Temp\test-project\.venv\lib\site-packages\constructs\_jsii\__init__.py", line 13, in <module>
    __jsii_assembly__ = jsii.JSIIAssembly.load(
  File "C:\Temp\test-project\.venv\lib\site-packages\jsii\_runtime.py", line 55, in load
    _kernel.load(assembly.name, assembly.version, os.fspath(assembly_path))
  File "C:\Temp\test-project\.venv\lib\site-packages\jsii\_kernel\__init__.py", line 299, in load
    self.provider.load(LoadRequest(name=name, version=version, tarball=tarball))
  File "C:\Temp\test-project\.venv\lib\site-packages\jsii\_kernel\providers\process.py", line 354, in load
    return self._process.send(request, LoadResponse)
  File "C:\Temp\test-project\.venv\lib\site-packages\jsii\_kernel\providers\process.py", line 342, in send
    raise RuntimeError(resp.error) from JavaScriptError(resp.stack)
RuntimeError: EPERM: operation not permitted, symlink 'C:\Users\anonymous\AppData\Local\AWS\jsii\package-cache\constructs\10.2.69\999a045971105d00548e478f26ed34c78a3f59c8d2761e5b10ff99bb96d18043' -> 'C:\Users\anonymous\AppData\Local\Temp\jsii-kernel-wBjjZK\node_modules\constructs'

@heuristics222
Copy link

Same problem here. Started happening to me when I updated to aws-cdk-lib 2.90.0 so I played around with the package versions a bit.

With the following dependencies, cdk commands run successfully

aws-cdk-lib==2.89.0
jsii==1.85.0

and with the next version, the above symlink error occurs (aws-cdk-lib 2.90.0 requires minimally jsii 1.86.0)

aws-cdk-lib==2.90.0
jsii==1.86.0

I also tried the following, which failed. So the issue is clearly with jsii 1.86.0, which makes sense from the call stack.

aws-cdk-lib==2.89.0
jsii==1.86.0

1.86.1 also fails.

In addition to downgrading your aws-cdk-lib/jsii versions, running cdk commands in adminstrator mode also seems to work as a workaround.

@hastarin
Copy link

hastarin commented Aug 7, 2023

Same issue with dotnet CDK.

@fsvoboda-acro
Copy link

It's mentioned in aws/jsii#4208 with some workaround.

@sagajain
Copy link

sagajain commented Aug 7, 2023

what is the solutions of above issue , same issue I am facing

@fsvoboda-acro
Copy link

what is the solutions of above issue , same issue I am facing

THIS

@ldecaro
Copy link

ldecaro commented Aug 8, 2023

CDK 2.88.0 running on Windows 11. Can't instantiate App as described above.
Running $env:JSII_RUNTIME_PACKAGE_CACHE="disabled" resolved the issue.

@sagajain
Copy link

sagajain commented Aug 8, 2023

CDK 2.88.0 running on Windows 11. Can't instantiate App as described above. Running $env:JSII_RUNTIME_PACKAGE_CACHE="disabled" resolved the issue.

Hi i am using windows10 and above solutions i did not get , i dont have administrator access

@rix0rrr rix0rrr self-assigned this Aug 8, 2023
@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 8, 2023

Fix pending here: aws/jsii#4212

@danarlee
Copy link

danarlee commented Aug 11, 2023

Same issue with Python CDK; however using the workaround above worked.
Created environment variable.
JSII_RUNTIME_PACKAGE_CACHE to "disabled".

@hastarin
Copy link

Looks like the fix mentioned by @rix0rrr has now been released. https://github.com/aws/jsii/releases/tag/v1.87.0

@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 14, 2023

Fix imported here, next release will have it: #26734

@rix0rrr rix0rrr closed this as completed Aug 14, 2023
@github-actions
Copy link

⚠️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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. effort/medium Medium work item – several days of effort p2 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

10 participants