serverless-nextjs / serverless-next.js

⚡ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
MIT License
4.47k stars 457 forks source link

Custom server example with serverless-next component? #211

Closed danielcnorris closed 5 years ago

danielcnorris commented 5 years ago

Is your feature request related to a problem? Please describe. I'm trying to deploy a Next app with a custom Koa server using the Serverless framework to AWS.

Describe the solution you'd like It would be awesome if I could use the serverless-next.js component in order to do this. I don't know if this is possible -- I'm still new to the Next ecosystem and don't know the internals of this component.

Describe alternatives you've considered I've tried using serverless-http and the Serverless backend component. I've tried to adapt commentary in places like: https://github.com/zeit/next.js/issues/1406, but I can't get it to work.

danielcnorris commented 5 years ago

Since the component uses the "serverless" target in next.config.js, does that mean it's not even possible to use a custom monolith server?

barrysteyn commented 5 years ago

They are two totally different architectures. Using this plugin will result in lambdas (behind api gateway) serving your site. This will not use Koa, and so if you have custom business logic within Koa, it probably won't work.

danielcnorris commented 5 years ago

Thanks!