serverless: Suddenly timeouts with every deploy

What went wrong

Have been using serverless for a few small Lambda functions and have really been enjoying it. All functions are very small but there are some additional deps in the graph and I notice that my last successful deployment was 178mb which is surprising because I thought Lambda limit was 50mb but maybe that’s just the way Serverless packages things up? As you can see even now my dependencies are quite small:

image

In any event, I went looking for other issues like mine and it seems there have been some but none open. In any event one thing I saw mentioned was trying:

SLS_DEBUG=true sls deploy -v

I tried that but the only additional info was a stack trace:

ServerlessError: Connection timed out after 120000ms
    at Response.req.send (/usr/local/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:142:20)
    at Request.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:355:18)
    at Request.callListeners (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at Request.emit (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:668:14)
    at Request.transition (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:670:12)
    at Request.callListeners (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
    at Request.emit (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:668:14)

With the main error message being:

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues

  Your Environment Information -----------------------------
     OS:                 darwin
     Node Version:       6.9.1
     Serverless Version: 1.1.0

Expected Outcome

These are very small lambda functions, I’d have expected them to go right through. I’m also concerned about the Lambda sizes that are showing up in AWS:

image

potentially this is just my mis-understanding but these look way out of proportion to what they should be.

Configuration

I’m on MacOS, using serverless version 1.1.0 and my serverless.yml has the following config:

service: mycompany-services

provider:
  name: aws
  runtime: nodejs4.3
  profile: truecash
  stage: prod
  region: eu-west-1

functions:
  authorize:
    handler: lib/authorize.handler
    events:
      - http: GET accounting/authorize

  accessToken:
    handler: lib/access-token.handler
    events:
      - http: GET accounting/accessToken

  accounting:
    handler: lib/get-accounting.handler
    events:
      - http: GET accounting/get

As a next step I will try using the serverless-optimizer-plugin that I noticed when researching this issue. Regardless if this helps me get this working I feel my very limited functions should work without the need for compression and so I’m raising this now.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 27 (10 by maintainers)

Most upvoted comments

With this work-around my 178mb function is now 8mb!

Thanks!

Here’s what I meant:

provider:
  name: aws
  runtime: nodejs4.3
  profile: truecash
  stage: prod
  region: eu-west-1
  package:
    include:
      - "lib/*"
      - "node_modules/firebase/**"
      - "node_modules/bluebird/**"
      - "node_modules/moment/**"
      - "node_modules/oauth/**"
      - "node_modules/dotenv/**"
      - "node_modules/lodash/**"
    exclude:
      - "*.mp3"
      - "test/*"
      - "src/*"
      - ".git/**"
      - ".serverless/*.zip"
      - "node_modules/**"

should be updated to look like this:

provider:
  name: aws
  runtime: nodejs4.3
  profile: truecash
  stage: prod
  region: eu-west-1

package:
  include:
    - "lib/*"
    - "node_modules/firebase/**"
    - "node_modules/bluebird/**"
    - "node_modules/moment/**"
    - "node_modules/oauth/**"
    - "node_modules/dotenv/**"
    - "node_modules/lodash/**"
  exclude:
    - "*.mp3"
    - "test/*"
    - "src/*"
    - ".git/**"
    - ".serverless/*.zip"
    - "node_modules/**"

This seems to ignore “uuid” package in node_modules:

package:
  include:
    - "node_modules/uuid/**"
  exclude:
    - "node_modules/**"

Update: my bad people, I had only updated my local serverless and not -g to 1.2.x 😉 🎱