aws-cdk: :exclamation: NOTICE (custom-resources): attribute error - vendor response doesn't contain `endpointAddress`
Please add your +1 👍 to let us know you have encountered this
Status: In progress
Describe the bug
If I upgrade cdk & cdk-lib to 2.138.0 from 2.137.0, the following error occurs at deployment.
If I rollback, the error goes away.
CustomResource attribute error: Vendor response doesn't contain endpointAddress attribute in object ...|...IoTEndpoint
This was previously working for quite some time.
The specific resource is an AwsCustomResource related to IoT.
(I could not find a way to get the endpoint using aws-cdk-lib/aws-iot, so had to use a custom resource)
Code repro below.
Expected Behavior
Deployment succeeds
Current Behavior
Deployment fails with the following error:
8:34:21 AM | UPDATE_FAILED | AWS::SSM::Parameter | fooservice/Stage2...IotEndpointAddress
CustomResource attribute error: Vendor response doesn't contain endpointAddress attribute in object
arn:aws:cloudformation:eu-central-1:<account>:stack/<...>|...IoTEndpoint...
Reproduction Steps
import * as cus from 'aws-cdk-lib/custom-resources'
// https://stackoverflow.com/a/77092236
const getIoTEndpoint = new cus.AwsCustomResource(this, 'IoTEndpoint', {
onCreate: {
service: 'Iot',
action: 'describeEndpoint',
// I am guessing the failure is on the following line (and/or below)
physicalResourceId: cus.PhysicalResourceId.fromResponse('endpointAddress'),
parameters: {
endpointType: 'iot:Data-ATS'
}
},
policy: cus.AwsCustomResourcePolicy.fromSdkCalls({ resources: cus.AwsCustomResourcePolicy.ANY_RESOURCE })
})
// I am guessing the failure is on the following line (and/or above)
const IOT_ENDPOINT = getIoTEndpoint.getResponseField('endpointAddress') // eg, abc...xyz-ats.iot.us-west-2.amazonaws.com
Possible Solution
Rollback cdk-lib to 2.137.0
Additional Information/Context
No response
CDK CLI Version
2.119.0 (build 0392e71)
Framework Version
2.138.0
Node.js Version
v20.7.0
OS
MacOS
Language
TypeScript
Language Version
5.4.5
Other information
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 19 (14 by maintainers)
Commits related to this issue
- chore: notice for https://github.com/aws/aws-cdk/issues/29949 (#521) CDK CLI notice for https://github.com/aws/aws-cdk/issues/29949 — committed to cdklabs/aws-cdk-notices by colifran 2 years ago
- fix(custom-resources): `logApiResponseData` is added to custom resource event properties by default (#30418) Closes #30121, #29949 ### Reason for this change PR #29648 introduced a new resource pro... — committed to aws/aws-cdk by colifran 2 years ago
- chore: add feature flag warning to notice for https://github.com/aws/aws-cdk/issues/29949 (#526) Adds a warning to let users know that they should set the `@aws-cdk/custom-resources:logApiResponseDat... — committed to cdklabs/aws-cdk-notices by colifran 2 years ago
- fix(custom-resources): `logApiResponseData` is added to custom resource event properties by default (#30418) Closes #30121, #29949 ### Reason for this change PR #29648 introduced a new resource pro... — committed to Leo10Gama/aws-cdk by colifran 2 years ago
- fix(custom-resources): `logApiResponseData` is added to custom resource event properties by default (#30418) Closes #30121, #29949 ### Reason for this change PR #29648 introduced a new resource pro... — committed to mazyu36/aws-cdk by colifran 2 years ago
In our case, with the help of AWS support, we were able to identify the problem, which was a missing
onUpdatehandler, which is required when performing a CDK version upgrade due to the added property.We are now using the same handler for
onCreateandonUpdatewhich returns the group name properly.I’m not sure if this is a “breaking change” or not, but I would suggest highlighting this properly in the changelog that the CDK version upgrade will cause an update to all Custom Resources.
This caused a bit of a fire drill for me today, too. I’m using a Custom Resource to work around the lack of native CloudFormation support of AWS::IdentityStore::User.
Previously, I had this code:
When I upgraded from 2.136.0 => 2.140.0, I started getting errors that looked like this:
The fix for me was changing the
getResponseFieldcode to use the Physical ID I’m setting on the user object:The documentation mentions that I shouldn’t use
getResponseFieldin my case (without anupdatecall), but I missed it the first time:I also added an
onUpdatethat callsUpdateUserCommandfor good measure.@markusl Thanks for the follow-up and I agree, this feels like a documentation miss on our end. From the perspective of the custom resource it saw an update and didn’t make an API call which is how it was configured. However, obviously you now don’t have a
groupIdsince your custom resource was configured to only make the API call on a create event. We’ll work on improving the documentation for this.Is this related to the issue now that a new attribute
logApiResponseDatahas been added? https://github.com/aws/aws-cdk/blob/c949076863719eea273bffa3ab45242b79caa99c/packages/aws-cdk-lib/aws-eks/lib/cluster-resource.ts#L95@pahud I can also confirm that there is a breaking change in
AwsCustomResourceafter2.137.0.The error message is
CustomResource attribute error: Vendor response doesn't contain GroupId attribute in object arn:aws:cloudformation:us-east-8:999999999999:stack/stack-name. TheGroupIddoes exist and is returned from the API when doing the API call.Can you please have a look at this since it is quite critical and would block us from deploying AWS SSO Assignments?
Regards, Markus