首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无服务器HTTP无服务器域管理器错误:找不到堆栈

问无服务器HTTP无服务器域管理器错误:找不到堆栈
EN

Stack Overflow用户
提问于 2022-01-21 16:15:02
回答 2查看 896关注 0票数 1

我正在尝试使用自定义域来部署基本的无服务器快速api示例- https://github.com/serverless/examples/tree/v2/aws-node-express-api。它使用HTTP Api而不是旧的REST网关。域已成功设置,证书已到位等,但当我运行serverless deploy时,它会引发一个错误:

代码语言:javascript
复制
Error: Unable to setup base domain mappings for mycustom.domain.name

添加SLS_DEBUG显示:

代码语言:javascript
复制
Service Information
-------------------
service: my-service-name
stage: staging
region: us-east-1
stack: my-service-name-staging
resources: 11
api keys:
  None
endpoints:
  ANY - https://123323.execute-api.us-east-1.amazonaws.com
functions:
  api: my-service-name-staging-api
layers:
  None
Serverless: [AWS cloudformation 400 1.296s 0 retries] describeStackResource({
  LogicalResourceId: 'ApiGatewayRestApi',
  StackName: 'my-service-name-staging'
})
Serverless: [AWS cloudformation 200 1.592s 0 retries] describeStacks({})
Serverless Domain Manager: Error: mycustom.domain.name:  Error: Failed to find a stack my-service-name-staging

Serverless Domain Manager: Error: mycustom.domain.name:  Error: Failed to find CloudFormation resources for mycustom.domain.name

显然堆栈存在,但无服务器域管理器无法找到它。我能不能通过HTTP通过无服务器域管理器使用自定义域??文档中只显示了一个手动方式来完成这个任务。任何帮助都将不胜感激,谢谢!

EN

回答 2

Stack Overflow用户

发布于 2022-01-22 16:16:48

很难在没有看到您的配置的情况下100%地回答,但是您确定您已经在apiType: http配置部分指定了customDomain吗?如果没有,则默认为rest。将其设置为http可以解决您的问题。

票数 1
EN

Stack Overflow用户

发布于 2022-10-21 17:50:54

由于您的完整serverless.yml不在这里,我想您使用的是默认的。我也有同样的问题,这是我的解决方案。这可能是您的customDomain文件中的.yml conf:

代码语言:javascript
复制
customDomain:
    domainName: sub.domain.com
    certificateName: '*.domain.com'
    basePath: ${sls:stage}
    stage: ${sls:stage} 
    createRoute53Record: true

唯一需要做的就是添加这两个属性来将域从边缘转换为区域:

代码语言:javascript
复制
  customDomain:
    domainName: sub.domain.com
    certificateName: '*.domain.com'
    basePath: ${sls:stage}
    stage: ${sls:stage} 
    createRoute53Record: true
    endpointType: regional <-- New Attribute (default is edge)
    apiType: http <-- New Attribute (default is rest)

请记住,如果您已经运行了sls create_domain命令(使用前面的serverless.yml配置),您可能会遇到以下错误:

代码语言:javascript
复制
Error:
Error: Unable to setup base domain mappings for 'sub.domain.com':
Unable to create base path mapping for 'sub.domain.com':
Only REGIONAL domain names can be managed through the API Gateway V2 API. For EDGE domain names, please use the API Gateway V1 API. Also note that only REST APIs can be attached to EDGE domain names.

造成此错误的原因是您已经使用前面的配置创建了边缘域,现在部署希望将其用作区域域。要解决此错误,只需使用sls delete_domain删除域,然后重新运行sls create_domain命令。我会自动为你创建新的记录。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70804311

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档