sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.12k stars 135 forks source link

ApiGatewayV2 does not allow using custom domains and custom stage names together #592

Open vvashisht opened 2 weeks ago

vvashisht commented 2 weeks ago

createDomainMapping() hard-codes the stage name as $default

This does work for cases where either the intended stage name is $default OR custom domain names are not being used.

If custom domains are used, aws.apigatewayv2.ApiMapping gets created with $default stage. This works.

If in addition, a custom stage name is intended, there is no ApiMapping for it. I tried to add it explicitly, but ApiGatewayV2 does not expose aws.apigatewayv2.DomainName in nodes which is needed for ApiMapping.

In general, in my opinion, ApiGatewayV2 should allow more extensibility. Either through subclassing, or exposing all underlying components in nodes, or both.

jayair commented 2 weeks ago

This is related to your other issue? https://github.com/sst/ion/issues/587

vvashisht commented 2 weeks ago

Stumbled on to it because of #587 but I think this issue can also come up without the situation presented there.

Workaround for #587 involved abandoning a custom domain name and using a CloudFront distribution instead, and managing my own aws.apigatewayv2.DomainName, aws.apigatewayv2.ApiMapping & aws.apigatewayv2.Stage.