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

Next on cloudflare #588

Closed
wants to merge 3 commits into from
Closed

Next on cloudflare #588

wants to merge 3 commits into from

Conversation

conico974
Copy link
Contributor

@conico974 conico974 commented Jun 21, 2024

This PR add partial support for Next on cloudflare.
For now only the middleware and the assets can be deployed on cloudflare, the rest needs to be on aws.

It requires this opennextjs/opennextjs-aws#449 to be merged to work perfectly ( Likely in 3.0.6 )

The assets are deployed on KV and all the cache related stuff are still in aws.

One big issues i've found while testing was that it seems impossible to invalidate cache when using only worker url. To fix this the cache is disabled by default when no domains is set.

Below is an open-next.config.ts file that works (and is necessary) to deploy :

import type {OpenNextConfig} from 'open-next/types/open-next.js'

const config  = {
  default: {
    override: {
      // This is not necessary, but useful to test streaming
      wrapper: 'aws-lambda-streaming',
    }
  }, 

  middleware: {
    external: true,
    override: {
      wrapper: 'cloudflare',
      converter: 'edge'
    }
  },
  imageOptimization: {
    // @ts-ignore
    loader: 'host',
    arch: 'x64'
  },
  // buildCommand: 'echo "Skipping build..."'
} satisfies OpenNextConfig

export default config

@thdxr
Copy link
Contributor

thdxr commented Oct 7, 2024

we are moving sst/ion -> sst/sst and unfortunately this is going to be a messy process because of github's limitations

i'm going to close this PR for now and it can be re-opened in the new sst/sst repo that will be ready in the next few days if still relevant

@thdxr thdxr closed this Oct 7, 2024
@conico974
Copy link
Contributor Author

we are moving sst/ion -> sst/sst and unfortunately this is going to be a messy process because of github's limitations

i'm going to close this PR for now and it can be re-opened in the new sst/sst repo that will be ready in the next few days if still relevant

Not sure what to do with this one. Given that now there is an official cloudflare OpenNext it makes sense that this should be at least renamed and moved to avoid confusion.

The ideal thing would be to rework the current NextJs construct and allow to have either cloudflare or cloudfront as a cdn in front (something generic would be the best so that every framework could use it) and also add support for ecs since this is supported in OpenNext itself. @thdxr what's your take on this ?

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

Successfully merging this pull request may close these issues.

2 participants