我试图使用无服务器域管理器将无服务器部署到AWS上的自定义域,但是每次我运行serverless create_domain时都会得到“未能创建自定义域”的通用错误。以下是我所采取的步骤和我的yml的内容:
privileges
G 212
.yml
service: service-name
plugins:
- serverless-apigw-binary
- serverless-apigwy-binary
- serverless-content-encoding
- serverless-api-cloudfront
- serverless-plugin-tracing
- serverless-domain-manager
custom:
apigwBinary:
types:
- 'image/jpeg'
- 'text/html'
- 'text/css'
- 'application/javascript'
- 'application/x-javascript'
- '*/*'
contentEncoding:
minimumCompressionSize: 0
stage: ${opt:stage, self:provider.stage}
domains:
prod: api.mydomain.com
test: api-test.mydomain.com
dev: api-dev.mydomain.com
customDomain:
basePath: ""
domainName: ${self:custom.domains.${self:custom.stage}}
stage: "${self:custom.stage}"
createRoute53Record: true
certificateArn: "cert-arn"
hostedZoneId: "zone-id"
provider:
name: aws
runtime: nodejs12.x
endpointType: regional
region: ap-southeast-2
memorySize: 3008
timeout: 300
tracing: true
iamRoleStatements:
- Effect: 'Allow'
Action:
- 'xray:PutTraceSegments'
- 'xray:PutTelemetryRecords'
- 'lambda:InvokeFunction'
Resource:
- '*'
package:
exclude:
- node_modules/aws-sdk/**
- .vscode/**
- bin/**
- obj/**
functions:
api:
warmup: true
handler: index.handler
events:
- http: ANY /
- http: 'ANY {proxy+}' 每次运行serverless create_domain时,我都会得到相同的泛型错误,没有额外的信息。
谢谢
发布于 2020-11-25 19:49:44
正如Erico所指出的,您可以从SLS_DEBUG获得更多的信息。可能是域证书有问题,调试消息会告诉您这一点。
在我的例子中,它似乎是一个证书问题,因为它在一个不同的AWS区域,所以sls create_domain找不到它。总的来说,这是一个相当令人困惑的经历。
请查看endpointType选项:
customDomain:
...
endpointType="regional"https://github.com/amplify-education/serverless-domain-manager/issues/46
发布于 2021-05-02 14:26:11
在我的示例中,我的托管区域位于另一个AWS帐户中,因此createRoute53Record: true未能创建route53记录,因此出现了泛型错误。
更改为createRoute53Record: false为我修复了错误。
https://stackoverflow.com/questions/64737597
复制相似问题