question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TimeoutError: Connection timed out after 120000ms

See original GitHub issue

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 image

Desktop (please complete the following information):

  • OS: Windows
  • Version 10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:25 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dphangcommented, Sep 20, 2020

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 of useServerlessTraceTarget. This is what I use for production since I use the regular serverless target: 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)

  webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
    if (isServer && !dev && process.env.NEXT_MINIMIZE === "true") {
      config.optimization = {
        minimize: true,
        minimizer: [
          new TerserPlugin({
            parallel: true,
            cache: true,
            terserOptions: {
              output: { comments: false },
              mangle: true,
              compress: true,
            },
            extractComments: false,
          }),
        ],
      };
    }

    return config;
  }

I’ll close the issue for now and work on improving the docs/code in the near future.

0reactions
oran1248commented, Sep 20, 2020

@dphang Thank you for the time and the help! 💪

Read more comments on GitHub >

github_iconTop Results From Across the Web

occasionally connection timeout from lambda function
It seems that the lambda Node.JS runtime is keeping a socket alive during the lambda execution, which is higher than 120,000 ms (2...
Read more >
Troubleshoot Lambda function retry and timeout issues when ...
Example error log where the API call connection was successful, but timed out after the API response took too long (socket timeout).
Read more >
Serverless deploy - connection timedout after 120000ms
Hi, I'm trying to deploy a Lambda function using exactly the same code co-workers have successfully used from another network, ...
Read more >
Upgrade to 4.5 and Active parallel loading / 30000ms timeout ...
Scheduled Data Model loads failed with request time out after 30000ms error. Error Code from the logs: Could not get JDBC Connection; nested...
Read more >
Lambda Task Timed Out After X Seconds - Dashbird
The Dashbird app will show you the most recent errors in your AWS account. Figure 4 below shows a list that includes the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found