-
Notifications
You must be signed in to change notification settings - Fork 4.5k
(custom-resources): Package does not exist #30067
Description
Describe the bug
I'm trying to use AwsCustomResource from Python for a couple of actions on @aws-sdk/client-cognito-identity-provider, and deployment keeps failing with errors like:
Received response status [FAILED] from custom resource. Message returned:
Package @aws-sdk/client-cognito-identity-provider does not exist. (RequestId: 99b79a89-1a17-4acf-864c-84b3ac3e5664)
Expected Behavior
The affected resource (see repro steps below) should deploy successfully and create a user in the provided Cognito user pool.
Current Behavior
I'm getting the above mentioned error message and the resource fails to create (or rollback/delete). Also tried providing the service name as CognitoIdentityServiceProvider but this gave the same error message (with @aws-sdk/client-cognito-identity-provider package name)
Possibly this may be intermittent, as I managed to get the stack to deploy (update existing to add this resource) at least once? But now facing the error consistently.
Reproduction Steps
Given Python CDK construct with a resource something like:
AwsCustomResource(
self,
"AwsCustomResource-CreateUser",
on_create=AwsSdkCall(
action="adminCreateUser",
parameters={
"UserPoolId": ...,
"Username": ...,
"MessageAction": "SUPPRESS",
"TemporaryPassword": ...,
},
physical_resource_id=PhysicalResourceId.of(
f"AwsCustomResource-CreateUser-{...}"
),
service="@aws-sdk/client-cognito-identity-provider",
),
on_delete=AwsSdkCall(
action="adminDeleteUser",
parameters={
"UserPoolId": ...,
"Username": ...,
},
service="@aws-sdk/client-cognito-identity-provider",
),
policy=AwsCustomResourcePolicy.from_sdk_calls(
resources=AwsCustomResourcePolicy.ANY_RESOURCE
),
install_latest_aws_sdk=True,
)...Try to deploy the stack
Possible Solution
🤷♂️
Additional Information/Context
Originally observed on CDK v1.126.0, so tried upgrading to 2.140.0 but it didn't help.
CDK CLI Version
2.140.0
Framework Version
2.140.0
Node.js Version
20.9.0
OS
macOS 14.4.1
Language
Python
Language Version
Python 3.12.1
Other information
Seems possibly related to #28005, which was closed due to inactivity but raised against an older CDK version.