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-cognito-identitypool-alpha: fromIdentityPoolArn Method throws when using a string from a StringParameter lookup #29780

Labels
@aws-cdk/aws-cognito-identitypool bug This issue is a bug. effort/small Small work item – less than a day of effort p3

Comments

@Xenoha
Copy link

Xenoha commented Apr 10, 2024

Describe the bug

When using the construct to lookup an IdentityPool from a SSM StringParameter. The construct throws validation errors because it is expecting an actual string of two parts separated by a ':'.

Expected Behavior

Should be able to lookup an Identity pool with a SSM StringParameter stringValue.

Current Behavior

Code at lines 118 of the Identitypool.js file throws
// if (!(idParts.length === 2)) // throw new Error('Invalid Identity Pool Id: Identity Pool Ids must follow the format <region>:<id>'); // if (idParts[0] !== pool.region) // throw new Error('Invalid Identity Pool Id: Region in Identity Pool Id must match stack region');

Reproduction Steps

const identityPool = IdentityPool.fromIdentityPoolArn(this, 'some-identityPool', indentityPoolStringParameter.stringValue)

Possible Solution

Review other constructs best practices for allowing SSM StringParameter lookup stringValue strings.

Additional Information/Context

No response

CDK CLI Version

2.135.0

Framework Version

No response

Node.js Version

20.12.0

OS

Linux

Language

TypeScript

Language Version

Typescript 5.4.4

Other information

No response

@Xenoha Xenoha added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 10, 2024
@khushail khushail 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 Apr 10, 2024
@khushail khushail self-assigned this Apr 10, 2024
@khushail
Copy link
Contributor

Thanks @Xenoha for reaching out . I can see in the code why this is producing an error -

if (!(idParts.length === 2)) throw new Error('Invalid Identity Pool Id: Identity Pool Ids must follow the format <region>:<id>');

const identityPoolArn = Stack.of(scope).formatArn({

@khushail khushail added p2 effort/small Small work item – less than a day of effort and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Apr 10, 2024
@khushail khushail removed their assignment Apr 10, 2024
@pahud pahud added p3 and removed p2 labels Jun 11, 2024
@ndltuan
Copy link

ndltuan commented Jun 25, 2024

I encountered a similar error, how do I fix them.

"@aws-cdk/aws-cognito-identitypool-alpha": "^2.100.0-alpha.0",
"aws-cdk-lib": "^2.100.0",

Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

1 similar comment
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.