open-next icon indicating copy to clipboard operation
open-next copied to clipboard

Update examples stack to use SST

Open khuezy opened this issue 4 months ago • 5 comments

https://github.com/opennextjs/opennextjs-aws/blob/main/examples/sst/stacks/AppRouter.ts#L4

We're currently using a custom CDK implementation (this was before ion released,) we should switch over to ion since that's what most people are using (coming from SST.)

ref: sst nextjs docs

khuezy avatar Aug 25 '25 14:08 khuezy

@conico974 @sommeeeer thoughts?

khuezy avatar Aug 25 '25 14:08 khuezy

I think we should do it. Should be pretty straight forward, however app-pages-router might need some changes. Currently its using splitted functions which is not supported in latest SST. After they changed the routing logic to be in a cloudfront function instead of cloudfront behaviors. From version >=3.10 its not working anymore.

You can see the splitted function here: https://github.com/opennextjs/opennextjs-aws/blob/9a83eb754ca82f830b1cc06d2d1470cd19173e0b/examples/app-pages-router/open-next.config.ts#L3-L8

sommeeeer avatar Aug 25 '25 21:08 sommeeeer

Was that intentional that the sst 3.10+ no longer supports splitted functions?

khuezy avatar Aug 25 '25 21:08 khuezy

Was that intentional that the sst 3.10+ no longer supports splitted functions?

Yeah, or you can actually read the Discord thread when it was released. I think its possible to make it work, but it would require some changes in SST. Especially ssr-site.ts and nextjs.ts

sommeeeer avatar Aug 25 '25 22:08 sommeeeer

I think if we switch to ion, we should rewrite the whole e2e stuff to run locally first. Ion doesn't support everything (splitted functions, lambda@edge, external middleware...), so i wouldn't move everything there either.

If we want to do that, we should do it properly so if I had to make a plan here, it would be :

  1. Make e2e work locally so that we can run CI for it on every PR (not only on main)
  2. Move like one app to the default ion construct (we can use multiple config file)
  3. Build new more complex construct for the other apps (something like here https://github.com/conico974/open-next-deploy)

conico974 avatar Aug 26 '25 06:08 conico974