Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApiGatewayV1Api.addRoutes does not properly split stacks #3742

Open
tim-helloquickly opened this issue Apr 10, 2024 · 0 comments
Open

ApiGatewayV1Api.addRoutes does not properly split stacks #3742

tim-helloquickly opened this issue Apr 10, 2024 · 0 comments

Comments

@tim-helloquickly
Copy link

tim-helloquickly commented Apr 10, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant