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

Issue when creating AwsCustomResource #7312

Closed
sean-smith opened this issue Apr 11, 2020 · 6 comments · Fixed by #16718
Closed

Issue when creating AwsCustomResource #7312

sean-smith opened this issue Apr 11, 2020 · 6 comments · Fixed by #16718
Assignees
Labels
@aws-cdk/custom-resources Related to AWS CDK Custom Resources bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@sean-smith
Copy link

Hi, I'm getting an error when creating the AwsCustomResource.

Reproduction Steps

cr.AwsCustomResource(self, 'Cloud9IAMMembership',
            resource_type='Custom::Cloud9IAMMembership', policy=cr.AwsCustomResourcePolicy.from_sdk_calls(resources=cr.AwsCustomResourcePolicy.ANY_RESOURCE)
            on_create=cr.AwsSdkCall(
                action='CreateEnvironmentMembership', 
                service='cloud9', 
                parameters={   
                    "environmentId": cloud9_instance.environment_id,
                    "permissions": "read-write",
                    "userArn": user.user_arn
                },
                physical_resource_id=cr.PhysicalResourceId.from_response("environmentId")
            ),
 )

Error Log

The error is Failed to create resource. AWS[call.service] is not a constructor:
image

Environment

  • CLI Version : 1.3.1
  • Framework Version: ``
  • OS : MacOS
  • Language : Python

This is 🐛 Bug Report

@sean-smith sean-smith added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 11, 2020
@SomayaB SomayaB added the @aws-cdk/custom-resources Related to AWS CDK Custom Resources label Apr 11, 2020
@jogold
Copy link
Contributor

jogold commented Apr 11, 2020

It should be Cloud9 and createEnvironmentMembership see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Cloud9.html

The underlying custom resource is using the AWS SDK for JavaScript.

@eladb
Copy link
Contributor

eladb commented Apr 12, 2020

Closing. Reopen if this is still an issue.

@eladb eladb closed this as completed Apr 12, 2020
@sean-smith
Copy link
Author

Thanks @jogold !

@eladb
Copy link
Contributor

eladb commented Apr 13, 2020

I wonder if we can do case insensitive match when we look up the api?

@jogold
Copy link
Contributor

jogold commented Apr 13, 2020

I wonder if we can do case insensitive match when we look up the api?

Easily achievable for the service, somewhat more complex for the action (uses getters and will rely on the internals of the SDK). Should we do it for the service?

@touzoku
Copy link

touzoku commented Sep 28, 2021

Maybe at least some more meaningful error?

mergify bot pushed a commit that referenced this issue Oct 27, 2021
…message (#16718)

fix(custom-resources): improve AwsSdkCall service error


Makes the error that occurs when an invalid service name is supplied more explicit.

Closes #7312


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this issue Feb 21, 2022
…message (aws#16718)

fix(custom-resources): improve AwsSdkCall service error


Makes the error that occurs when an invalid service name is supplied more explicit.

Closes aws#7312


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/custom-resources Related to AWS CDK Custom Resources bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants