Dotnet WepAPI Swagger UI page does not open when deployed in aws using terraform

I created a project in Visual Studio 2019 using C# AWS Serverless Application template and ASP.NET Core Web API aws Blueprint.The application is integrated with NSwag Swagger package.

Deployed C# AWS Serverless Application ASP.NET Core WebAPI using Terraform.

I tried to open Swagger UI interface of my WebAPI application, I am getting “Failed to load API definition. Fetch error undefined /Stage/swagger/v1/swagger.json” error. APIs works fine from Postman.

Terraform code is based upon https://registry.terraform.io/providers/hashicorp/aws/2.34.0/docs/guides/serverless-with-aws-lambda-and-api-gateway

When I deployed the same application from Visual Studio 2019 by clicking “Publish to AWS Lambda”, APIs are working. Able to see Swagger UI interface of my application and APIs also work fine from swagger ui page…

Do I need to do anything extra settings to enable swagger UI when deployed using Terraform.