Skip to content

Serverless creating a "null" folder upon deploying #689

@ToneVDB

Description

@ToneVDB

When deploying the service to AWS lambda, serverless uploads a zip, as expected, to S3.
The size of the lambda was unusualy big, resulting in a failed deployment, so i decided to download the zip file.
Error thrown by serverless:
Resource handler returned message: "Unzipped size must be smaller than 262144000 bytes (Service: Lambda, Status Code: 400

Upon downloading and expanding the zip, I found that there is a folder called "null" that is 342MB big
Screenshot 2022-03-23 at 08 12 01

This folder is quite big and contains yarn for some reason?
Inside of the 'serverless-python-requirements' folder are 2 sub folders:

  1. a 51MB folder called "downloadCacheslspyc"
  2. a 150MB folder with my poetry dependencies

There is also a .Cache folder of 60MB that I dont know how it got there.
Because the zip is so big, the deployment keeps failing.
I tried adding more ignores to the package patterns, but with no luck so far.

Could this be due to this plugin or should I report this to the main serverless repo?
All guidance is apreciated.

My package.json:

{
  "name": "api",
  "license": "Unlicense",
  "description": "",
  "version": "0.1.0",
  "devDependencies": {
    "serverless": "^3.7.2",
    "serverless-domain-manager": "^6.0.2",
    "serverless-newrelic-lambda-layers": "^3.0.0",
    "serverless-plugin-warmup": "^7.1.0",
    "serverless-python-requirements": "^5.1.1"
  }
}

My serverless.json:

{
    "service": "api",
    "frameworkVersion": "3",
    "provider": {
      "name": "aws",
      "stage": "${opt:stage}",
      "runtime": "python3.9",
      "iam": {
        "role": {
          "statements": [
            {
              "Effect": "Allow",
              "Action": ["lambda:InvokeFunction", "dynamodb:*"],
              "Resource": "*"
            }
          ]
        }
      }
    },
    "functions": {
      "main": {
        "handler": "src/main.handler",
        "events": [
          {
            "http": "ANY /"
          },
          {
            "http": {
              "path": "/{proxy+}",
              "method": "any",
              "cors": true
            }
          }
        ],
        "timeout": 30,
        "warmup": {
          "default": {
            "enabled": true
          }
        }
      }
    },
    "package": {
      "patterns": [
        "!venv",
        "!*.Jenkinsfile",
        "!node_modules",
        "!src/tests",
        "!Dockerfile",
        "!terraform",
        "!config"
      ]
    },
    "plugins": [
      "serverless-domain-manager",
      "serverless-plugin-warmup",
      "serverless-python-requirements"
    ],
    "custom": {
     "pythonRequirements": {
        "usePoetry": true,
        "usePipenv": false,
        "slim": true
      },
      "stage": "${opt:stage}",
      "warmup": {
        "default": {
          "enabled": true
        }
      }
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions