Open danielweil opened 3 years ago
There is this git repository that uses this lib to convert it into azure Functions, but there is not support for getStaticProps && getInitialProps:
Yes it is on the roadmap as per some other issues, but I think first we need to refactor existing Lambda@Edge implementation. I am already simplifying the existing implementation so there is only one handler (no origin response handler) which uses S3 client to retrieve pages and perform static regeneration, fallbacks etc.
However, we need to also decouple the AWS specific stuff from the actual routing code (e.g S3/SQS/CloudFront stuff is mixed into the handlers) and move it into a lambda-at-edge plugin. The core code should be more abstracted to allow for different drop-in implementations of an object store, queue etc (not just S3, SQS, etc.) Currently there is core
package which has some of this but would like to move more into it. I'm planning to try to mostly finish this decoupling for AWS this year.
If you or someone is interested in the Azure part, it would be good to start with the following (as I am currently mainly the only one working on this, I am working on maintenance + Lambda/Lambda@Edge parts):
@sls-next/azure-plugin
package to bundle, package and deploy assuming all the assets are there (e.g similar to in .serverless_nextjs
). For example you can start to create an Azure handler for pages/APIs (probably just a single one since Next.js has now optimized code splitting), image optimization that will be deployable, though it will not be doing anything / or connected to any of the routing code yet.Hi Daniel, as I mentioned, in the comment above, I found out a repo that implements a wrapper to make it Azure compatible, but it doesn't work with server side features. It gets the output of api-lambdas folder and creates a router for the api part, passing it through the wrapper.
I am not sure I have the js skills to help out, or the time for it, but I will continue to have a look at it for now. Now I am trying to get a page with serverSideProps to run on Azure Function like it works with the api, but I think the router used does not work for this task, as it is from an old version. I will try to adapt the handler function to make this single page work, so I can make sure we can get through as I need in a project of mine.
If I am successfull, I can start having a look at a Azure replacement for S3 to host the static part.
What do you think? Will keep you posted!
Awesome work!
Do you guys plan to support other cloud providers as Azure?