serverless-components / express

⚡ Take existing Express.js apps and host them easily on cheap, auto-scaling, serverless infrastructure (AWS Lambda and AWS HTTP API).
https://serverless.com/components
Apache License 2.0
375 stars 34 forks source link

Multi-Level Subdomains #45

Open colinc opened 3 years ago

colinc commented 3 years ago

When attempting to use this component with a custom, multi-level subdomain (for example, api.micro-service.widget.co) the deployment fails with the error "The domain name to be created is not covered by the provided certificate".

It looks like this is coming from: https://github.com/serverless-components/express/blob/77ab7ad185f7f3d76b394b43b6aecce507a1b3dc/src/utils.js#L497

Because it's looking for the "naked domain", and attaching the wildcard on the first level subdomain, the certificate ends up being issued for widget.co with an addition name for *.widget.co, neither of which are valid for api.micro-service.widget.co.

Perhaps I'm misunderstanding and there's a workaround or setup step I'm missing. However, if not, I can provide a pull request.