I am using the serverless framework and AWS Lambdas to deploy two function with different path names (/message
and /subscribe
) to my subdomain at form.example.com
.
I am using the serverless-domain-manager
plugin for serverless and successfully configured my domain for the /message
function using serverless create_domain
, but since I also needed to do that for /subscribe
I tried to follow the same process receiving messages that the domain already existed and caught an error Error: Unable to create basepath mapping.
.
After flipping a configuration (createRoute53Record: false
) and re-running it started to work, but now when I run sls deploy
for my /message
function I get the error message I used to see for /subscribe
.
Error (from sls deploy
):
layers:
None
Error --------------------------------------------------
Error: Unable to create basepath mapping.
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Here is my config for the serverless-domain-manager
:
plugins:
- serverless-offline
- serverless-domain-manager
custom:
transactionDomain:
dev: ${file(./local-keys.yml):transactionDomain}
prod: ${ssm:mg-production-transaction-domain~true}
newsletterDomain:
dev: ${file(./local-keys.yml):newsletterDomain}
prod: ${ssm:mg-production-newsletter-domain~true}
apiKey:
dev: ${file(./local-keys.yml):apiKey}
prod: ${ssm:mg-production-api-key~true}
customDomain:
domainName: form.example.com
certificateName: 'www.example.com' //sub-domain is included in the certificate
stage: 'prod'
createRoute53Record: true
Does this have to do with the deployment of two functions to the same domain? Is there a proper process to allow that to happen?
If you do not need API gateway specific features, such as usage plan. You can put two lambda behind ALB per path routing.