I’m using Serverless Framework v2.56.0 with
@serverless/typescript. I’ve created a serverless.ts file that includes a “default” function as per the AWS Guide on API Gateway: Working with routes for HTTP APIs - Amazon API Gateway
The path in this example should just be
$default, however it looks like when the serverless framework builds the cloudformation stack, it’s prepending a leading slash to ALL paths, so it becomes
/$default, which is then reported as invalid when deploying the stack:
An error occurred: HttpApiRouteGetdefault - The provided route key is not formatted properly for HTTP protocol. Format should be "[HTTP METHOD] /[RESOURCE PATH]" or "$default" (Service: AmazonApiGatewayV2; Status Code: 400; Error Code: BadRequestException
Is there any way to create a default function with Serverless Framework and API Gateway?