Search code examples
angularamazon-web-servicesaws-lambdaaws-api-gatewayamazon-cloudfront

AWS Cloudfront error with a lambda function


I have an angular application running on lambda. Everything works fine accessing the application via the default domain given by AWS. The problem is when I try to use my custom domain with api-gateway. The browser seems to reach the lambda function but it throws the following error:

Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec

Solution

  • I ended up taking a workaround. I used a serverless plugin called "Serverless-domain-manager" that managed all the api-gateway configuration. That made the trick.

    Hope this can help someone with a similar problem :)