You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pages/v3/index.mdx
+15-6Lines changed: 15 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,13 @@ import { Callout } from 'nextra/components'
2
2
3
3
<Callouttype="warning"emoji="⚠️">
4
4
5
-
`[email protected].2` is here!!! Please report any issues you find on [discord](https://discord.com/channels/983865673656705025/1164872233223729152) or on the github [PR](https://github.com/sst/open-next/pull/327)
5
+
`[email protected].3` is here!!! Please report any issues you find on [discord](https://discord.com/channels/983865673656705025/1164872233223729152) or on the github [PR](https://github.com/sst/open-next/pull/327)
6
6
7
-
This is a release candidate, it is not yet ready for production, but we are getting close. We are looking for feedback on this release, so please try it out and let us know what you think. See [getting started](#get-started) to quickly test it.
7
+
This is a release candidate, it is mostly ready for production (You might still experience some quirks). We are looking for feedback on this release, so please try it out and let us know what you think. See [getting started](#get-started) to quickly test it.
8
8
9
9
It also requires an updated version of the IAC tools that you use, see the sst PR [here](https://github.com/sst/sst/pull/3567) for more information.
10
+
11
+
You could also use SST Ion which should support it out of the box pretty soon. See [here for more info](https://github.com/sst/ion) or in the [ion discord](https://discord.com/channels/983865673656705025/1177071497974648952).
10
12
</Callout>
11
13
12
14
## What's new in V3?
@@ -26,8 +28,13 @@ import { Callout } from 'nextra/components'
26
28
- Custom initialization function
27
29
28
30
- Allow for splitting, you can now split your next app into multiple servers, which could each have their own configuration
31
+
- Allow to move the middleware/routing part in a separate lambda or cloudflare workers in front of your server functions
29
32
- An experimental bundled `NextServer` could be used which can reduce the size of your lambda by up to 24 MB
30
-
- Support for the `edge` runtime of next (Only app router for now, only 1 route per function)
33
+
- Experimental support for the `edge` runtime of next with some limitations:
34
+
- Only app router for now
35
+
- Only 1 route per function
36
+
- Works fine in node, only for api route in cloudflare workers
37
+
- No support for `revalidateTag` or `revalidatePath` for now
31
38
32
39
## Get started
33
40
@@ -46,13 +53,15 @@ You also need to create an `open-next.config.ts` file in your project root, you
Then you need to run `npx [email protected] build` to build your project before running the `sst deploy` or `cdk deploy` command to deploy your project.
65
+
Then you need to run `npx [email protected] build` to build your project before running the `sst deploy` or `cdk deploy` command to deploy your project.
66
+
67
+
In V3 `open-next build` don't accept any arguments, all the args are passed in the `open-next.config.ts` file.
There is a couple of requirements necessary for open-next V3 to work.
2
+
It will be divided by functionality. This is still WIP, feel free to open a PR if you think something is missing.
3
+
4
+
## General
5
+
- For the node runtime, you need at least Node 18.
6
+
- For the edge runtime, you can use both Node 18+ or cloudflare workers with `node_compat` flag enabled (Cloudflare workers support is experimental)
7
+
- Open-next doesn't work well on Windows. We recommend using WSL2 or a Linux VM.
8
+
9
+
## ISR/SSG
10
+
ISR/SSG has 2 types of cache, the Incremental Cache and the Tag Cache. To actually trigger the ISR revalidation, we use a Queue system.
11
+
12
+
The tag cache is only used in app router.
13
+
### Incremental Cache
14
+
By default we use S3 as the incremental cache. You can override this in `open-next.config.ts`. For this to work you need to provide server functions with the following environment variables:
15
+
- CACHE_BUCKET_REGION
16
+
- CACHE_BUCKET_NAME
17
+
- CACHE_BUCKET_KEY_PREFIX
18
+
19
+
### Tag Cache
20
+
By default we use DynamoDb as the tag cache. For this to work you need to provide server functions with the following environment variables:
21
+
- CACHE_DYNAMO_TABLE
22
+
- CACHE_BUCKET_REGION
23
+
24
+
### Queue
25
+
By default we use SQS as the queue. fFr this to work you need to provide server functions with the following environment variables:
26
+
- REVALIDATION_QUEUE_REGION
27
+
- REVALIDATION_QUEUE_URL
28
+
29
+
## External Middleware
30
+
If you decide to use external middleware, you need to provide the following environment variables:
31
+
- OPEN_NEXT_ORIGIN
32
+
33
+
This env variable should contain a stringified version of this, with every key corresponding to the key used in functions inside `open-next.config.ts`:
34
+
```ts
35
+
// For cloudflare workers
36
+
// THIS IS TEMPORARY, WE WILL CHANGE THIS TO USE THE SAME FORMAT AS NODE
37
+
{
38
+
default: "example.com",
39
+
ssr: "example2.com",
40
+
ssg: "example3.com"
41
+
}
42
+
// Or for node
43
+
{
44
+
default: {
45
+
host: "example.com",
46
+
protocol: "https",
47
+
port: 443// Optional
48
+
customHeaders: {
49
+
"x-custom-header": "value"
50
+
} // Optional, headers that you'd want to pass to the origin
51
+
},
52
+
...
53
+
}
54
+
```
55
+
56
+
## Image Optimization
57
+
For image optimization to work, you need to provide the following environment variables:
0 commit comments