I’ve started by making the basePath ‘’ (none). A simple curl to custom domain endpoint would return a response. For example
const serverless = require("serverless-http");
const express = require("express");
const app = express();
app.get("/", (req, res, next) => {
return res.status(200).json({
message: "Hello from root!",
});
});
app.get("/hello", (req, res, next) => {
return res.status(200).json({
message: "Hello world",
});
});
app.get("/test", (req, res, next) => {
return res.status(200).json({
message: "Test 1",
});
});
app.use((req, res, next) => {
return res.status(404).json({
error: "Not Found",
});
});
exports.handler = serverless(app);
> curl https://lambda.foobar.com/hello
Hello world
I then modify the serverless.yml, and make the basePath: v1, sls deploy it. When complete I run the curl command which returns:
> curl https://lambda.foobar.com/v1/hello
{"error":"Not Found"}%
Here’s the serverless.yml
org: xxxxx
app: test-aws-node-express-api
service: nodejs-test
provider:
name: aws
runtime: nodejs20.x
region: eu-west-2
stage: prod
functions:
api:
handler: handler.handler
events:
- http:
path: /
method: get
- http:
path: hello
method: get
- http:
path: test
method: get
plugins:
- serverless-domain-manager
custom:
customDomain:
domainName: lambda.foobar.com
certificateArn: arn:aws:acm:eu-west-2:yyyyyyyy:certificate/xxxxxxxx
basePath: v1
stage: ${self:provider.stage}
createRoute53Record: false
endpointType: regional
securityPolicy: tls_1_2
Also, tested delete_domain and create_domain but issue persists.