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

Error when using ssm parameter for congnitoprefix>domainprefix #8314

Closed
jasonwu890105 opened this issue Jun 2, 2020 · 2 comments · Fixed by #8399
Closed

Error when using ssm parameter for congnitoprefix>domainprefix #8314

jasonwu890105 opened this issue Jun 2, 2020 · 2 comments · Fixed by #8399
Assignees
Labels
@aws-cdk/aws-cognito Related to Amazon Cognito bug This issue is a bug. good first issue Related to contributions. See CONTRIBUTING.md p1

Comments

@jasonwu890105
Copy link

jasonwu890105 commented Jun 2, 2020

userPool: userPool,
  cognitoDomain: {
    domainPrefix: `${cfSubDomain}-test`}
});

Where cfSubDomain value is:

const cfSubDomain = ssm.StringParameter.valueForStringParameter(
       this,
       '/test-app/cfSubDomain'
   );

Supposedly, in Cognito domain, the ${cfSubDomain} should be substituted by the value of cfSubDomain from SSM.
When CDK prints cfSubDomain, I got ${Token[TOKEN.1223]}, normally ${Token[TOKEN.1223]} is only used during synth time, these actually get filled in with the correct value.
That normally works for other services, but not for Cognito this time. As the error saying " throw new Error('domainPrefix for cognitoDomain can contain only lowercase alphabets, numbers and hyphens'); "

===== Error Trace =====

error:
      throw new Error('domainPrefix for cognitoDomain can contain only lowercase alphabets, numbers and hyphens');
            ^
Error: domainPrefix for cognitoDomain can contain only lowercase alphabets, numbers and hyphens
    at new UserPoolDomain (D:\Users\mspitz\works\fix\ass\infra-kyc-pipeline\node_modules\@aws-cdk\aws-cognito\lib\user-pool-domain.ts:92:13)
    at new KycCognito (D:\Users\mspitz\works\fix\ass\infra-kyc-pipeline\lib\cognito\cognito-stack.ts:90:20)
    at Object.<anonymous> (D:\Users\mspitz\works\fix\ass\infra-kyc-pipeline\bin\kyc.ts:98:17)
    at Module._compile (internal/modules/cjs/loader.js:1176:30)
    at Module.m._compile (D:\Users\mspitz\works\fix\ass\infra-kyc-pipeline\node_modules\ts-node\src\index.ts:858:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
    at Object.require.extensions.<computed> [as .ts] (D:\Users\mspitz\works\fix\ass\infra-kyc-pipeline\node_modules\ts-node\src\index.ts:861:12)
    at Module.load (internal/modules/cjs/loader.js:1040:32)
    at Function.Module._load (internal/modules/cjs/loader.js:929:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
Subprocess exited with error 1
Error: Subprocess exited with error 1
    at ChildProcess.<anonymous> (D:\Users\mspitz\AppData\Roaming\npm\node_modules\aws-cdk\lib\api\cxapp\exec.ts:118:23)

Environment

  • Language: TypeScript
  • OS: Windows

This is 🐛 Bug Report

@jasonwu890105 jasonwu890105 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 2, 2020
@SomayaB SomayaB added @aws-cdk/aws-ssm Related to AWS Systems Manager @aws-cdk/aws-cognito Related to Amazon Cognito labels Jun 2, 2020
@MrArnoldPalmer
Copy link
Contributor

@nija-at Is this an issue with cognito not being token aware?

@nija-at
Copy link
Contributor

nija-at commented Jun 3, 2020

Yep, seems like it. Feel free to assign it to me.

@nija-at nija-at added good first issue Related to contributions. See CONTRIBUTING.md p1 and removed @aws-cdk/aws-ssm Related to AWS Systems Manager needs-triage This issue or PR still needs to be triaged. labels Jun 4, 2020
nija-at pushed a commit that referenced this issue Jun 5, 2020
Adds recognition of tokens for all validations that validate the content
in some form.

fixes #8314
@mergify mergify bot closed this as completed in #8399 Jun 7, 2020
mergify bot pushed a commit that referenced this issue Jun 7, 2020
Adds recognition of tokens for all validations that validate the content
in some form.

fixes #8314


----

*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/aws-cognito Related to Amazon Cognito bug This issue is a bug. good first issue Related to contributions. See CONTRIBUTING.md p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants