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

(AWS-CDK): (not able to run the CDK synth command on local machine) #29945

Closed
rameshjoshi13 opened this issue Apr 24, 2024 · 2 comments
Closed
Assignees
Labels
bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. package/tools Related to AWS CDK Tools or CLI response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@rameshjoshi13
Copy link

Describe the bug

I have the below version for my aws-cdk

D:\AWS_PYTHON_CDK>npm --version 10.5.2

D:\AWS_PYTHON_CDK>node --version v20.12.2

D:\AWS_PYTHON_CDK>python --version Python 3.12.3

D:\AWS_PYTHON_CDK>aws --version aws-cli/2.15.40 Python/3.11.8 Windows/10 exe/AMD64 prompt/off

D:\AWS_PYTHON_CDK>cdk --version 2.138.0 (build 6b41c8b)

I am able to create a python cdk project inside the AWS_PYTHON_CDK folder using cdk init and the requirement.txt file is showing the dependencies to be installed as aws-cdk-lib==2.138.0 constructs>=10.0.0,<11.0.0

but when I am trying to do cdk synth its throwing error, the error trace is as below.

D:\AWS_PYTHON_CDK>cdk synth Traceback (most recent call last): File "D:\AWS_PYTHON_CDK\app.py", line 4, in import aws_cdk as cdk File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\site-packages\aws_cdk_init_.py", line 1511, in from .jsii import * File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\site-packages\aws_cdk_jsii_init.py", line 21, in jsii_assembly = jsii.JSIIAssembly.load( ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\site-packages\jsii_runtime.py", line 55, in load kernel.load(assembly.name, assembly.version, os.fspath(assembly_path)) File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\site-packages\jsii_kernel_init.py", line 299, in load self.provider.load(LoadRequest(name=name, version=version, tarball=tarball)) File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\site-packages\jsii_kernel\providers\process.py", line 354, in load return self._process.send(request, LoadResponse) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\site-packages\jsii_kernel\providers\process.py", line 332, in send self._next_message(), _ProcessResponse ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\site-packages\jsii_kernel\providers\process.py", line 251, in _next_message return json.loads(self.process.stdout.readline(), object_hook=ohook) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\json_init.py", line 359, in loads return cls(**kw).decode(s) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) Exception ignored in atexit callback: <bound method _NodeProcess.stop of <jsii._kernel.providers.process._NodeProcess object at 0x000002830E43D880>> Traceback (most recent call last): File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\site-packages\jsii_kernel\providers\process.py", line 295, in stop self._process.stdin.close() OSError: [Errno 22] Invalid argument

Expected Behavior

It should generate the output instead of throwing error.

Current Behavior

Its throwing an error on executing command "cdk synth" as mentioned above in the description

Reproduction Steps

Run command - cdk synth

Possible Solution

No response

Additional Information/Context

I have configure AWS properly and have confirmed by running the command
aws sts get-caller-identity and got response in below format.
{
"UserId": "AID************",
"Account": "767********",
"Arn": "arn:aws:iam::767********:user/testuser"
}

CDK CLI Version

2.138.0

Framework Version

No response

Node.js Version

v20.12.2

OS

windows 10

Language

Python

Language Version

No response

Other information

No response

@rameshjoshi13 rameshjoshi13 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 24, 2024
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Apr 24, 2024
@ashishdhingra ashishdhingra self-assigned this Apr 24, 2024
@ashishdhingra ashishdhingra added needs-reproduction This issue needs reproduction. and removed needs-triage This issue or PR still needs to be triaged. labels Apr 24, 2024
@ashishdhingra
Copy link

@rameshjoshi13 Good afternoon. Somehow I'm unable to reproduce the issue. Have you followed instructions at the below documentation properly:

I was able to follow the instructions to the point and cdk synth successfully generated the below CloudFormation template (My command prompt looks something like (.venv) D:\source\repros\cdk\issue29945_python>cdk synth):

Resources:
  CDKMetadata:
    Type: AWS::CDK::Metadata
    Properties:
      Analytics: v2:deflate64:H4sIAAAAAAAA/zPSMzS21DNQTCwv1k1OydbNyUzSqw4uSUzO1nFOywtKLc4vLUpOBbGd8/NSMksy8/NqdQIqSzLy8/SN9QyN9IwVs4ozM3WLSvNKMnNT9YIgNABkjCGkVwAAAA==
    Metadata:
      aws:cdk:path: Issue29945PythonStack/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.

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-reproduction This issue needs reproduction. labels Apr 24, 2024
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Apr 27, 2024
@github-actions github-actions bot added closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels May 2, 2024
@github-actions github-actions bot closed this as completed May 2, 2024
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. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. package/tools Related to AWS CDK Tools or CLI response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants