ApiGatewayV1Api.addRoutes does not properly split stacks
tim-helloquickly opened this issue · comments
tim-helloquickly commented
Hello!
ApiGatewayV1Api.addRoutes adds routes to the root apigateway stack rather than the V2 behaviour (where it is added to the stack it is called in). I've pulled this out of my codebase but this is a minimally reproducible example. I tried replacing it with the Api construct and it properly splits everything. Is there any workarounds for this?
// SST config
function SecondAPI({ stack, app }: StackContext) {
const { api } = use(API);
api.addRoutes(stack, {
"POST /test1": {
function: {
handler: "services/path/to/index.ts",
},
},
});
}
export function API(context: StackContext) {
const api = new ApiGatewayV1Api(context.stack, "testing", {
cors: true
});
return { api };
}
export default {
config() {
return {
name: "test-app-sls",
};
},
stacks(app) {
app
.stack(API)
.stack(SecondAPI)
},
} satisfies SSTConfig;
If you've already posted your issue on Discord, make sure to leave a link to it here.
https://discord.com/channels/983865673656705025/1226944125643784213