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

cdk_monitoring_constructs: failed to read values from parameter store #30110

Closed
andreprawira opened this issue May 8, 2024 · 2 comments
Closed
Assignees
Labels
@aws-cdk/aws-ssm Related to AWS Systems Manager bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@andreprawira
Copy link

andreprawira commented May 8, 2024

Describe the bug

I'm trying to read values from string list parameter that was created in a different stack (the code for the other stack works and the parameter store got created) when using cdk_monitoring_constructs module. However, i keep getting this error

@jsii/kernel.RuntimeError: Error: Resolution error: Resolution error: Resolution error: Resolution error: Resolution error: Cannot add elements to list token, got: AWS/EC2,CPUUtilization,InstanceId,#{Token[TOKEN.2245]},[object Object].
  Object creation stack:
    at stack traces disabled.
  Object creation stack:
    at Execute again with CDK_DEBUG=true to capture stack traces.
  Object creation stack:
    at Execute again with CDK_DEBUG=true to capture stack traces..
      at Kernel._Kernel_ensureSync (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:10491:23)
      at Kernel.invoke (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:9855:102)
      at KernelHost.processRequest (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:11696:36)
      at KernelHost.run (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:11656:22)
      at Immediate._onImmediate (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:11657:46)
      at process.processImmediate (node:internal/timers:476:21)

here is my code,

worker_instance_ids = ssm.StringListParameter.from_string_list_parameter_name(
            self,
            "WorkerInstanceIdsParam",
            string_list_parameter_name="worker-instance-ids",
        ).string_list_value

        consolidated_dashboard = MonitoringFacade(
            self, f"{props.prefix}-Consolidated-Dashboard"
        )
        consolidated_dashboard.monitor_ec2_instances(
            instance_ids=worker_instance_ids,
            human_readable_name="Worker Instance",
        )

Expected Behavior

The strings inside parameter store list should have been passed and consumed normally because instance_ids expect Sequence[str] and i am passing a List[str].

Current Behavior

I'm getting this error

@jsii/kernel.RuntimeError: Error: Resolution error: Resolution error: Resolution error: Resolution error: Resolution error: Cannot add elements to list token, got: AWS/EC2,CPUUtilization,InstanceId,#{Token[TOKEN.2245]},[object Object].
  Object creation stack:
    at stack traces disabled.
  Object creation stack:
    at Execute again with CDK_DEBUG=true to capture stack traces.
  Object creation stack:
    at Execute again with CDK_DEBUG=true to capture stack traces..
      at Kernel._Kernel_ensureSync (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:10491:23)
      at Kernel.invoke (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:9855:102)
      at KernelHost.processRequest (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:11696:36)
      at KernelHost.run (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:11656:22)
      at Immediate._onImmediate (C:\Users\ANDREP~2\AppData\Local\Temp\tmpbekmebwb\lib\program.js:11657:46)
      at process.processImmediate (node:internal/timers:476:21)

Reproduction Steps

Please read the description above

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.131.0 (build 92b912d)

Framework Version

No response

Node.js Version

v18.17.1

OS

windows

Language

Python

Language Version

3.11.1

Other information

No response

@andreprawira andreprawira added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 8, 2024
@github-actions github-actions bot added the @aws-cdk/aws-ssm Related to AWS Systems Manager label May 8, 2024
@ashishdhingra ashishdhingra self-assigned this May 9, 2024
@ashishdhingra ashishdhingra added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels May 9, 2024
@ashishdhingra
Copy link
Contributor

Hi @andreprawira,

Good morning. Thanks for reporting the issue. Per documentation for ssm::StringListParameter.from_string_list_parameter_name(), the return type of this method is IStringListParameter (not list or array of string values). It is an IStringListParameter object. Instead, IStringListParameter.string_list_value property should be used, if instance_ids in your code accept a string sequence.

Please confirm if above guidance works.

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels May 9, 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 May 11, 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 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ssm Related to AWS Systems Manager bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. 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