Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

aws-cdk/aws-cognito-identitypool-alpha: IdentityPool.fromIdentityPool* static methods do not support Fn.importValue #28184

Closed
uyrussell21 opened this issue Nov 29, 2023 · 5 comments · Fixed by #30882
Labels
@aws-cdk/aws-cognito-identitypool bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@uyrussell21
Copy link

Describe the bug

Using Fn.importValue method from aws-cdk-lib as input for IdentityPool.fromIdentityPoolArn or IdentityPool.fromIdentityPoolId will error out:

Error: Invalid Identity Pool Id: Identity Pool Ids must follow the format <region>:<id>

Expected Behavior

I expected for Fn.importValue to be a supported argument for fromIdentityPoolArn or fromIdentityPoolId static methods

Current Behavior

Using Fn.importValue('outputName') as ARN or Id arg throws out:

Error: Invalid Identity Pool Id: Identity Pool Ids must follow the format <region>:<id>

Reproduction Steps

// StackWithIdPool
import * as cognito_identitypool_alpha from "@aws-cdk/aws-cognito-identitypool-alpha";

const existingIdentityPool = new cognito_identitypool_alpha.IdentityPool(
  this,
  "IdentityPool",
  {
    identityPoolName: "some-id-pool",
    allowUnauthenticatedIdentities: true,
  }
);

new cdk.CfnOutput(this, "ExistingIdentityPoolArn", {
  value: existingIdentityPool.identityPoolArn,
  exportName: "existingIdentityPoolArn",
});
// AnotherStack

cognito_identitypool_alpha.IdentityPool.fromIdentityPoolArn(
  scope,
  'ExistingIdentityPool',
  Fn.importValue('existingIdentityPoolArn'),
);

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.110.1-1

Framework Version

No response

Node.js Version

18.13.0

OS

Windows 10

Language

TypeScript

Language Version

No response

Other information

No response

@uyrussell21 uyrussell21 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 29, 2023
@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 Nov 29, 2023
@khushail khushail self-assigned this Nov 30, 2023
@pahud pahud added p2 effort/medium Medium work item – several days of effort labels Nov 30, 2023
@khushail khushail removed their assignment Dec 8, 2023
@khushail khushail removed the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Dec 8, 2023
@BwL1289
Copy link

BwL1289 commented Mar 5, 2024

This is also true if using an SSM parameter.

@BwL1289
Copy link

BwL1289 commented Mar 5, 2024

I'm pretty sure the static methods are completely broken. Im not sure how it's possible, but if I hardcode the ARN value directly into identity_pool_arn, it works.

If i pass a variable of any kind (even if that variable is hardcoded), it errors RuntimeError: Error: ARNs must start with "arn:" and have at least 6 components:

For example, this works:

self._cognito_identity_pool = IdentityPool.from_identity_pool_arn(
    self,
    "CognitoIdentityPool",
    identity_pool_arn="XXXXXXX",
)

This does not work:

identity_pool_arn="XXXXXXX"
self._cognito_identity_pool = IdentityPool.from_identity_pool_arn(
    self,
    "CognitoIdentityPool",
    identity_pool_arn=identity_pool_arn,
)

@dylan-westbury
Copy link

How is it possible to achieve without hardcoding value? Tried SSM and cfnExport

dummy-value-for-identityPoolId is what's set which is against validation

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
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
@aws-cdk/aws-cognito-identitypool bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants