sst / open-next

Open source Next.js serverless adapter
https://open-next.js.org
MIT License
3.73k stars 112 forks source link

deploy open-next bundle without sst on aws #357

Closed NikolozMS closed 2 months ago

NikolozMS commented 5 months ago

guys i've bundled nextjs application with open-next and trying to host it on aws, but after bundling i have only .cache files for ISR (inside cache folder), there are not html files, how these files should be handled and what am i supposed to do ? (without sst) thanks in advanced

fwang commented 5 months ago

@NikolozMS in SST both static assets and ISR cache are uploaded to the same s3 bucket. Assets to the _assets folder, and cache to the _cache folder. And the CloudFront S3 origin path points to the _assets folder. You can do something similar. Here's the relevant code — https://github.com/sst/sst/blob/master/packages/sst/src/constructs/NextjsSite.ts#L346-L358

NikolozMS commented 5 months ago

hello @fwang , thanks for response.

I want to deploy open-next bundled project to AWS, i read open-next documentation about architecture and how does ISR work, but I have some misunderstandings about how the whole process work

for example:

conico974 commented 5 months ago

We use the cache handler properties by next to provide our own handler https://github.com/sst/open-next/blob/main/packages/open-next/src/adapters/cache.ts https://nextjs.org/docs/pages/building-your-application/deploying#configuring-caching

How does revalidation function communicate with server function if it does

https://open-next.js.org/inner_workings/isr

We check lastModified from the S3 response

how does it update the cache

We just write the new data to S3

NikolozMS commented 4 months ago

thanks fwang <3

conico974 commented 2 months ago

Not really an issue, if you have more questions you should ask them on discord