serverless-domain-manager
serverless-domain-manager copied to clipboard
Allow external api id for HTTP API
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Bug Report
Error Description
When using HTTP API there's currently no way to use an API that's created in a different stack.
The problem is in the getApiId() function. More specifically:
https://github.com/amplify-education/serverless-domain-manager/blob/257664190acf6e5148cf083149823e68c6d587e1/index.ts#L682-L683
Plugin tries to look up the HttpApi resource in the stack, and it's not there. Even if it was, it could be there with a different name.
Command Run
sls deploy
Console Output
Error: Error: Unable to setup base domain mappings somedomain.com
Domain Manager Configuration
custom:
customDomain:
domainName: somedomain.com
basePath: dev
stage: dev
certificateName: somedomain.com
createRoute53Record: true
endpointType: 'regional'
apiType: http
securityPolicy: tls_1_2
hostedZoneId: XYZ
Versions
- Domain Manager version(s): 4.0.0
- Node/npm version: 12.16.1/6.13.4
- Serverless Version: 1.69.0
- Lambda Code: Javascript
Possible Solution
Somewhere at the top of getApiId(), similar to how REST API is handled, add:
if (this.serverless.service.provider.httpApi && this.serverless.service.provider.httpApi.id) {
this.serverless.cli.log(`Mapping custom domain to existing HTTP API
${this.serverless.service.provider.httpApi.id}.`);
return this.serverless.service.provider.httpApi.id;
}
My current workaround is this config (serverless.yml):
provider:
httpApi:
id: myApiIdHere
apiGateway: # added to keep serverless-domain-manager happy
restApiId: myApiIdHere # added to keep serverless-domain-manager happy
Adding this apiGateway entry doesn't seem to have any side effects... yet anyway.
I am having the same issue with latest serverless /domain-manager versions.
I am having the same issue
Hi @webpepper
Hope you have solved this issue.
We are not supporting version 4.x anymore please try our latest version 6.x and let us know in case of any issues