Cognito 用户池域的动态域名前缀
Dynamic domain name prefix for Cognito User Pool domain
我正在使用 Serverless Framework 创建一个 Cognito 用户池,并且根据我正在部署的阶段,我想要 myapp-dev
、myapp-staging
等域名前缀。代码我在 serverless.yml
中使用的是这样的:
CognitoUserPoolDomain:
Type: AWS::Cognito::UserPoolDomain
Properties:
Domain: myapp-${self:custom_stage}
UserPoolId:
Ref: CognitoUserPool
和
custom:
stage: ${opt:stage, self:provider.stage}
${self:custom_stage}
变量适用于所有其他资源,但不适用于域名,因为它会抱怨非法字符。还有其他方法吗?
正在看AWS Documentation, I would say your issue isn't with using the variable '${self:custom_stage}' but in that you are providing a string for the name without the top-level-domain伴奏。尝试将后缀添加到名称中(例如:.com)。
事实证明,我使用的真实姓名而不是 myapp
没有被接受,因为它包含数字字符。我已经删除了它们,现在可以使用了。
不过,它不知道为什么不接受数字字符,正如文档所说的那样可以使用它们。
我正在使用 Serverless Framework 创建一个 Cognito 用户池,并且根据我正在部署的阶段,我想要 myapp-dev
、myapp-staging
等域名前缀。代码我在 serverless.yml
中使用的是这样的:
CognitoUserPoolDomain:
Type: AWS::Cognito::UserPoolDomain
Properties:
Domain: myapp-${self:custom_stage}
UserPoolId:
Ref: CognitoUserPool
和
custom:
stage: ${opt:stage, self:provider.stage}
${self:custom_stage}
变量适用于所有其他资源,但不适用于域名,因为它会抱怨非法字符。还有其他方法吗?
正在看AWS Documentation, I would say your issue isn't with using the variable '${self:custom_stage}' but in that you are providing a string for the name without the top-level-domain伴奏。尝试将后缀添加到名称中(例如:.com)。
事实证明,我使用的真实姓名而不是 myapp
没有被接受,因为它包含数字字符。我已经删除了它们,现在可以使用了。
不过,它不知道为什么不接受数字字符,正如文档所说的那样可以使用它们。