无服务器部署到暂存域名
Serverless Deployment to staging domain name
我正在尝试使用无服务器框架将 API 部署到 AWS 中的域名。我希望能够将阶段作为选项传递并部署到该自定义域名。
例如,舞台 dev
应该 dev-api.firstcivdivcareers.com
.
我在 Route53 中有域,为可能的域创建了 public 证书,但是当我 运行 命令时,我得到以下错误。这要么是我尝试在无服务器中使用选项和变量的方式,要么是我没有在 AWS 中设置的方式。
仍在学习如何使用无服务器,因此欢迎任何我可以用来调试的建议或命令。
错误:
$ serverless deploy --stage dev
Serverless: Deprecation warning: Starting with next major version, API Gateway naming will be changed from "{stage}-{service}" to "{service}-{stage}".
Set "provider.apiGateway.shouldStartNameWithService" to "true" to adapt to the new behavior now.
More Info: https://www.serverless.com/framework/docs/deprecations/#AWS_API_GATEWAY_NAME_STARTING_WITH_SERVICE
Serverless: Bundling with Webpack...
Serverless: No external modules needed
Serverless: Packaging service...
Serverless: Installing dependencies for custom CloudFormation resources...
Error --------------------------------------------------
Error: Unable to fetch information about undefined
at APIGatewayWrapper.<anonymous> (/Users/kyle/Code/firstcivdivcareers/serverless/JobPostsAPI/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-wrapper.js:109:27)
at Generator.throw (<anonymous>)
at rejected (/Users/kyle/Code/firstcivdivcareers/serverless/JobPostsAPI/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-wrapper.js:6:65)
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 12.18.0
Framework Version: 2.25.2
Plugin Version: 4.4.3
SDK Version: 2.3.2
Components Version: 3.7.0
Serverless.yaml:
service: jobpostsapi
app: firstcivdivcareers
org: kycalica
frameworkVersion: '2'
plugins:
- serverless-bundle
- serverless-domain-manager
custom:
customDomain: ${opt:stage}-api.firstcivdivcareers.com
domainName: ${opt:stage}-api.firstcivdivcareers.com
basePath: ''
stage: ${opt:stage}
endPointType: regional
certificateName: '_90e79ed1be1d0eac6e388ed7c2f865d2.firstcivdivcareers.com'
createRoute53Record: true
enabled: true
provider:
name: aws
runtime: nodejs12.x
lambdaHashingVersion: 20201221
functions:
payment:
handler: handler.payment
events:
- http:
method: post
path: '/payment'
首先尝试修复 custom
部分中的缩进。 domainName
和 basePath
应该在 customDomain
:
下
custom:
customDomain:
domainName: ${opt:stage}-api.firstcivdivcareers.com
baseName
是可选的,所以如果您不需要它,就不要包含它。
我正在尝试使用无服务器框架将 API 部署到 AWS 中的域名。我希望能够将阶段作为选项传递并部署到该自定义域名。
例如,舞台 dev
应该 dev-api.firstcivdivcareers.com
.
我在 Route53 中有域,为可能的域创建了 public 证书,但是当我 运行 命令时,我得到以下错误。这要么是我尝试在无服务器中使用选项和变量的方式,要么是我没有在 AWS 中设置的方式。
仍在学习如何使用无服务器,因此欢迎任何我可以用来调试的建议或命令。
错误:
$ serverless deploy --stage dev
Serverless: Deprecation warning: Starting with next major version, API Gateway naming will be changed from "{stage}-{service}" to "{service}-{stage}".
Set "provider.apiGateway.shouldStartNameWithService" to "true" to adapt to the new behavior now.
More Info: https://www.serverless.com/framework/docs/deprecations/#AWS_API_GATEWAY_NAME_STARTING_WITH_SERVICE
Serverless: Bundling with Webpack...
Serverless: No external modules needed
Serverless: Packaging service...
Serverless: Installing dependencies for custom CloudFormation resources...
Error --------------------------------------------------
Error: Unable to fetch information about undefined
at APIGatewayWrapper.<anonymous> (/Users/kyle/Code/firstcivdivcareers/serverless/JobPostsAPI/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-wrapper.js:109:27)
at Generator.throw (<anonymous>)
at rejected (/Users/kyle/Code/firstcivdivcareers/serverless/JobPostsAPI/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-wrapper.js:6:65)
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 12.18.0
Framework Version: 2.25.2
Plugin Version: 4.4.3
SDK Version: 2.3.2
Components Version: 3.7.0
Serverless.yaml:
service: jobpostsapi
app: firstcivdivcareers
org: kycalica
frameworkVersion: '2'
plugins:
- serverless-bundle
- serverless-domain-manager
custom:
customDomain: ${opt:stage}-api.firstcivdivcareers.com
domainName: ${opt:stage}-api.firstcivdivcareers.com
basePath: ''
stage: ${opt:stage}
endPointType: regional
certificateName: '_90e79ed1be1d0eac6e388ed7c2f865d2.firstcivdivcareers.com'
createRoute53Record: true
enabled: true
provider:
name: aws
runtime: nodejs12.x
lambdaHashingVersion: 20201221
functions:
payment:
handler: handler.payment
events:
- http:
method: post
path: '/payment'
首先尝试修复 custom
部分中的缩进。 domainName
和 basePath
应该在 customDomain
:
custom:
customDomain:
domainName: ${opt:stage}-api.firstcivdivcareers.com
baseName
是可选的,所以如果您不需要它,就不要包含它。