opennextjs / opennextjs-aws

Open-source Next.js adapter for AWS
https://opennext.js.org
MIT License
4.42k stars 131 forks source link

GCP Support #8

Open djanogly opened 1 year ago

djanogly commented 1 year ago

Hey, awesome project

Do you currently have any plan to support GCP? I find AWS's Lambda functions quite restrictive (size, runtime limits) compared to GCP's Cloud Functions / Cloud Run

I'm not sure what service could be used for the middleware, as I don't think GCP have a Lambda@Edge equivalent

Cheers

fwang commented 1 year ago

Hi @djanogly, there is a variant setup where the middleware can run inside a Lambda instead of at the end. So if there isn't a Lambda@Edge equivalent service in GCP, this could work.

The downside with this setup is that, if a page uses middleware, it cannot be served from the cache (even if it's a static page). The page has to be server rendered in order for middleware to run.

conico974 commented 2 months ago

This is possible now (since the V3 release), it would require a bit of work though.

You'll need to create a custom wrapper, converter, incremental cache, queue, tag cache and image loader (the wrapper and converter is probably not needed for cloud run) https://opennext.js.org/aws/config/custom_overrides.

The easiest would be for someone to create a lib to automatically do all of this in the open-next.config.ts I'll keep this open if someone want to try to tackle this