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: README.md
+20-2Lines changed: 20 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -294,9 +294,27 @@ Here's a link deployed using SST's [`NextjsSite`](https://docs.sst.dev/construct
294
294
295
295
## Debugging
296
296
297
-
To find the **server and image optimization** log, go to the AWS CloudWatch console in the **region you deployed to**.
297
+
To find the **server and image optimization log**, go to the AWS CloudWatch console in the **region you deployed to**.
298
298
299
-
To find the **middleware** log, go to the AWS CloudWatch console in the **region you are physically close to**. For example, if you deployed your app to `us-east-1` and you are visiting the app from in London, the logs are likely to be in `eu-west-2`.
299
+
To find the **middleware log**, go to the AWS CloudWatch console in the **region you are physically close to**. For example, if you deployed your app to `us-east-1` and you are visiting the app from in London, the logs are likely to be in `eu-west-2`.
300
+
301
+
#### Debug mode
302
+
303
+
You can run OpenNext in debug mode by setting the `OPEN_NEXT_DEBUG` environment variable:
304
+
305
+
```bash
306
+
OPEN_NEXT_DEBUG=true npx open-next@latest build
307
+
```
308
+
309
+
This does two things:
310
+
311
+
1. Lambda handler functions in the build output will not be minified.
312
+
1. Lambda handler functions will automatically `console.log` the request event object along with other debugging information.
313
+
314
+
It is recommended to **turn off debug mode when building for production** because:
315
+
316
+
1. Un-minified function code is 2-3X larger than minified code. This will result in longer Lambda cold start times.
317
+
1. Logging the event object on each request can result in a lot of logs being written to AWS CloudWatch. This will result in increated AWS costs.
// WORKAROUND: Pass headers from middleware function to server function (AWS specific) — https://github.com/serverless-stack/open-next#workaround-pass-headers-from-middleware-function-to-server-function-aws-specific
// WORKAROUND: Pass headers from middleware function to server function (AWS specific) — https://github.com/serverless-stack/open-next#workaround-pass-headers-from-middleware-function-to-server-function-aws-specific
0 commit comments