Skip to content

Commit 57c6d94

Browse files
authored
[aws]: refactor docs (#91)
1 parent e100c75 commit 57c6d94

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

pages/aws/common_issues.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,16 @@ export const initSentry = (runtime: "nodejs" | "edge") => {
9999
});
100100
};
101101
```
102+
103+
#### Empty body in response when streaming in AWS Lambda
104+
105+
We have seen trouble in the past with streaming hanging in AWS Lambda when the response body is empty.
106+
We currently have a workaround in OpenNext for this by setting the environment variable `OPEN_NEXT_FORCE_NON_EMPTY_RESPONSE` to `true`.
107+
This will write something to the stream to make sure it is not empty.
108+
109+
#### The Yarn Plug'n'Play manifest forbids importing "xxx" here because it's not listed as a dependency of this package
110+
111+
This error is usually resolved by removing all yarn files in your repo. You should also look in your `package.json` and see if you have `yarn` set as `packageManager` there. Removing it will solve the issue.
112+
If you use `yarn` there is a workaround [here](https://stackoverflow.com/a/76902985https://stackoverflow.com/a/76902985).
113+
114+
If you are not using `yarn` and you see `yarn` related errors it might be solved by running `corepack disable` or updating `nvm` to `0.40.2`.

pages/aws/comparison.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
It should be noted that open-next does not actually deploy the app. It only bundles everything for your IAC to deploy it.
1+
It should be noted that OpenNext does not actually deploy the app. It only bundles everything for your IAC to deploy it.
22

33
Here is a table comparing the different options to deploy a next.js app:
44

pages/aws/inner_workings.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ my-next-app/
1919
revalidation-function/ -> Handler code for revalidation backend
2020
image-optimization-function/ -> Handler code for image optimization backend
2121
warmer-function/ -> Cron job code to keep server function warm - Not mandatory
22-
dynamo-provider/ -> Code for a custom resource to populate the Tag Cache - Only necessary for app dir
22+
dynamodb-provider/ -> Code for a custom resource to populate the Tag Cache - Only necessary for app dir
2323
```

pages/aws/inner_workings/caching.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Caching in Next and OpenNext
22

3-
Caching could be become tricky very fast when using Next outside of Vercel. There is a lot of things that need to be taken into account.
3+
Caching could become tricky very fast when using Next outside of Vercel. There is a lot of things that need to be taken into account.
44

55
Usually, you'll deploy your Next app with a CDN in front of it. This CDN will cache the responses from your Next app and serve them to the users. This is great for performance, but it can also be a problem when you need to invalidate the cache. We provide some code examples in this doc to help with [cloudfront cache invalidation](#cloudfront-cache-invalidation). **In OpenNext, you only need to do this if you do On Demand Revalidation**.
66

pages/aws/inner_workings/routing.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,19 @@ Here is a list of features that OpenNext routing system handle:
1919
#### Next Middleware
2020

2121
The Next middleware in OpenNext is not running in the same way as in Next.js. In Next.js, the middleware is running inside the `NextServer` inside a fake edge runtime. In OpenNext, we modify the middleware and run it fully inside the routing layer. So if you run the routing layer in Node, you can use Node api inside the middleware (it's a bit tricky because it won't work with `next dev` and involves some workaround because Next will remove Node api during bundling. Some example [here](/aws/config/custom_overrides#define-a-global-to-use-node-in-the-middleware)).
22+
23+
On latest Next 15(works with latest OpenNext aswell) you can now add an `experimental` setting in `next.config.ts` to enable `nodejs` as the runtime for the middleware:
24+
25+
```ts
26+
const nextConfig: NextConfig = {
27+
experimental: {
28+
nodeMiddleware: true,
29+
},
30+
};
31+
// and then in your `middleware.ts` you put:
32+
export const config = {
33+
runtime: "nodejs",
34+
};
35+
```
36+
37+
Here is the [PR](https://github.com/vercel/next.js/pull/75624) that introduced this feature in Next.

0 commit comments

Comments
 (0)