aws / jsii

jsii allows code in any language to naturally interact with JavaScript classes. It is the technology that enables the AWS Cloud Development Kit to deliver polyglot libraries from a single codebase!
https://aws.github.io/jsii
Apache License 2.0
2.66k stars 247 forks source link

Unhandled exception. Amazon.JSII.Runtime.JsiiError: Child process exited unexpectedly #4576

Open ivanovvitaly opened 4 months ago

ivanovvitaly commented 4 months ago

Describe the bug

I'm trying to walk through the CDK sample tutorial for the dotnet and getting an error when running cdk synth.

Expected Behavior

The command runs successfully and produces CloudFormation template

Current Behavior

cdk synth fails with an error

PS C:\Development\cdk-workshop> cdk synth
Unhandled exception. Amazon.JSII.Runtime.JsiiError: Child process exited unexpectedly!
   at Amazon.JSII.Runtime.Services.Runtime.ReadResponse()
   at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
   at Amazon.JSII.Runtime.Services.Client.Hello()
   at Amazon.JSII.Runtime.Services.ServiceContainer.BuildServiceProvider(ILoggerFactory loggerFactoryOverride)
   at Amazon.JSII.Runtime.Services.ServiceContainer.<>c.<.cctor>b__8_0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Amazon.JSII.Runtime.Services.ServiceContainer.get_ServiceProvider()
   at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
   at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
   at Amazon.JSII.Runtime.Deputy.DeputyBase..ctor(DeputyProps props)
   at Constructs.Construct..ctor(DeputyProps props)
   at Amazon.CDK.Stage..ctor(DeputyProps props)
   at Amazon.CDK.App..ctor(IAppProps props)
   at CdkWorkshop.Program.Main(String[] args) in C:\Development\cdk-workshop\src\CdkWorkshop\Program.cs:line 12
C:\Users\Vitalii:1
[8094:A82C][2024-06-05T17:48:48]i001: Burn v3.10.4.4718, Windows v10.0 (Build 22621: Service Pack 0), path: C:\WINDOWS\Temp\{859CB0D2-AE7C-4ECE-AD90-7A83516D38BC}\.cr\VC_redist.x64.exe
     ^

SyntaxError: Unexpected token ':'
    at wrapSafe (node:internal/modules/cjs/loader:1281:20)
    at Module._compile (node:internal/modules/cjs/loader:1321:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.15.1

Subprocess exited with error 3762504530

after trying several times the error might be shorter like this

Unhandled exception. Amazon.JSII.Runtime.JsiiError: Child process exited unexpectedly!
   at Amazon.JSII.Runtime.Services.Runtime.ReadResponse()
   at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
   at Amazon.JSII.Runtime.Services.Client.Hello()
   at Amazon.JSII.Runtime.Services.ServiceContainer.BuildServiceProvider(ILoggerFactory loggerFactoryOverride)
   at Amazon.JSII.Runtime.Services.ServiceContainer.<>c.<.cctor>b__8_0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Amazon.JSII.Runtime.Services.ServiceContainer.get_ServiceProvider()
   at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
   at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
   at Amazon.JSII.Runtime.Deputy.DeputyBase..ctor(DeputyProps props)
   at Constructs.Construct..ctor(DeputyProps props)
   at Amazon.CDK.Stage..ctor(DeputyProps props)
   at Amazon.CDK.App..ctor(IAppProps props)
   at CdkWorkshop.Program.Main(String[] args) in C:\Development\cdk-workshop\src\CdkWorkshop\Program.cs:line 12

Subprocess exited with error 3762504530

Reproduction Steps

Possible Solution

No response

Additional Information/Context

My home folder is C:\Users\Vitalii Ivanov, I suspect the space in my username causes the issue, but only for dotnet project.

CDK CLI Version

2.149.0 (build c8e5924)

Framework Version

No response

Node.js Version

20.15.1

OS

windows 11 - 22H2 (22621.3880)

Language

.NET

Language Version

.net 6

Other information

I wasn't able to reproduce the issue for the typescript project on the same machine.

cdk init generates .net 6 project, upgrading to .net 8 doesn't help.

I tried to change the temporary folder location as described here and after that cdk synth produced CF template successfully for the dotnet project.

ashishdhingra commented 4 months ago

@ivanovvitaly Good morning. Thanks for opening the issue. Although, I'm unable to reproduce the issue:

cdk synth successfully generated the below CloudFormation template without any error:

Resources:
  CDKMetadata:
    Type: AWS::CDK::Metadata
    Properties:
      Analytics: v2:deflate64:H4sIAAAAAAAA/yXGsQ6CMBCA4Wdhp9dWjAmDg6muDGjYoZzJid6R9tCB+O6GmH/4/h34fQ2u6D/ZxHEyTxpgvWofpzLcucUsS4q4fRAeSUn4W55FG1R7AAeVt9BcbkESnubZdJgyCR/fFXjrwW0Vj0xk0sJKL4T27w9sliIieAAAAA==
    Metadata:
      aws:cdk:path: VitaliiIvanovStack/CDKMetadata/Default
    Condition: CDKMetadataAvailable
Conditions:
  CDKMetadataAvailable:
    Fn::Or:
      - Fn::Or:
          - Fn::Equals:
              - Ref: AWS::Region
              - af-south-1
          - Fn::Equals:
              - Ref: AWS::Region
              - ap-east-1
          - Fn::Equals:
              - Ref: AWS::Region
              - ap-northeast-1
          - Fn::Equals:
              - Ref: AWS::Region
              - ap-northeast-2
          - Fn::Equals:
              - Ref: AWS::Region
              - ap-south-1
          - Fn::Equals:
              - Ref: AWS::Region
              - ap-southeast-1
          - Fn::Equals:
              - Ref: AWS::Region
              - ap-southeast-2
          - Fn::Equals:
              - Ref: AWS::Region
              - ca-central-1
          - Fn::Equals:
              - Ref: AWS::Region
              - cn-north-1
          - Fn::Equals:
              - Ref: AWS::Region
              - cn-northwest-1
      - Fn::Or:
          - Fn::Equals:
              - Ref: AWS::Region
              - eu-central-1
          - Fn::Equals:
              - Ref: AWS::Region
              - eu-north-1
          - Fn::Equals:
              - Ref: AWS::Region
              - eu-south-1
          - Fn::Equals:
              - Ref: AWS::Region
              - eu-west-1
          - Fn::Equals:
              - Ref: AWS::Region
              - eu-west-2
          - Fn::Equals:
              - Ref: AWS::Region
              - eu-west-3
          - Fn::Equals:
              - Ref: AWS::Region
              - il-central-1
          - Fn::Equals:
              - Ref: AWS::Region
              - me-central-1
          - Fn::Equals:
              - Ref: AWS::Region
              - me-south-1
          - Fn::Equals:
              - Ref: AWS::Region
              - sa-east-1
      - Fn::Or:
          - Fn::Equals:
              - Ref: AWS::Region
              - us-east-1
          - Fn::Equals:
              - Ref: AWS::Region
              - us-east-2
          - Fn::Equals:
              - Ref: AWS::Region
              - us-west-1
          - Fn::Equals:
              - Ref: AWS::Region
              - us-west-2
Parameters:
  BootstrapVersion:
    Type: AWS::SSM::Parameter::Value<String>
    Default: /cdk-bootstrap/hnb659fds/version
    Description: Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]
Rules:
  CheckBootstrapVersion:
    Assertions:
      - Assert:
          Fn::Not:
            - Fn::Contains:
                - - "1"
                  - "2"
                  - "3"
                  - "4"
                  - "5"
                - Ref: BootstrapVersion
        AssertDescription: CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI.

I changed $env:TMP to D:\cdkrepro\Vitalii Ivanov temporarily and got the below error:

Unhandled exception. node:internal/modules/cjs/loader:1148
  throw err;
  ^

Error: Cannot find module 'D:\cdkrepro\Vitalii'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.15.1
Amazon.JSII.Runtime.JsiiError: Child process exited unexpectedly!
   at Amazon.JSII.Runtime.Services.Runtime.ReadResponse()
   at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
   at Amazon.JSII.Runtime.Services.Client.Hello()
   at Amazon.JSII.Runtime.Services.ServiceContainer.BuildServiceProvider(ILoggerFactory loggerFactoryOverride)
   at Amazon.JSII.Runtime.Services.ServiceContainer.<>c.<.cctor>b__8_0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Amazon.JSII.Runtime.Services.ServiceContainer.get_ServiceProvider()
   at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
   at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
   at Amazon.JSII.Runtime.Deputy.DeputyBase..ctor(DeputyProps props)
   at Constructs.Construct..ctor(DeputyProps props)
   at Amazon.CDK.Stage..ctor(DeputyProps props)
   at Amazon.CDK.App..ctor(IAppProps props)
   at VitaliiIvanov.Program.Main(String[] args) in D:\cdkrepro\Vitalii Ivanov\src\VitaliiIvanov\Program.cs:line 12

Subprocess exited with error 3762504530

It appears that the default value of $env:TMP is set to <<Drive>>:\Users\<<username>>\AppData\Local\Temp on Windows machine. In your case, it is C:\Users\Vitalii Ivanov\AppData\Local\Temp, which resulted in the error since your username contained space character.

So looks like the other issue https://github.com/aws/jsii/issues/1296 was not reopened after comment by other AWS SDK engineer.

I will transfer this issue to JSII repository.

Thanks, Ashish

ivanovvitaly commented 4 months ago

@ashishdhingra Thanks a lot troubleshooting and quick response!