serverless-next.js: TimeoutError: Connection timed out after 120000ms
Describe the bug
When I run serverless command, after something like ~6 minutes, I get the following error:
TimeoutError: Connection timed out after 120000ms
api-lambda folder size is 189MB
default-lambda folder size is 100MB
To Reproduce
I just run serverless.
Expected behavior Deployed successfully.
Screenshots

Desktop (please complete the following information):
- OS: Windows
- Version 10
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 25 (3 by maintainers)
Yup, no worries. For completeness sake, I forgot to mention you can also minimize your Next.js build outputs using something like this in
next.config.js. It can be used instead ofuseServerlessTraceTarget. This is what I use for production since I use the regularserverlesstarget: it makes the build take longer but my Lambda ZIP is ~20% smaller. Only caveat is by minimizing perhaps it’ll make it harder to debug if you don’t have useful error messaging or logging, as you can’t refer to line number in source code.(Use
terser-webpack-plugin)I’ll close the issue for now and work on improving the docs/code in the near future.