Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

.requirements.zip is included twice when using package: individually #365

@yannvgn

Description

@yannvgn

Hi 👋

I've noticed that when using zip: true and package: individually: true, .requirements.zip gets included twice in the package zip file if module is not defined or if it is set to ..

Example:

serverless.yml

service: serverless-hello-world

provider:
  name: aws
  runtime: python3.6

functions:
  helloWorld:
    handler: handler.helloWorld

plugins:
  - serverless-python-requirements

package:
  individually: true
  exclude:
    - "**"
  include:
    - handler.py

custom:
  pythonRequirements:
    zip: true
sls package
zipinfo .serverless/helloWorld.zip

zipinfo output:

Archive:  .serverless/helloWorld.zip
Zip file size: 1023 bytes, number of entries: 4
-rw-r--r--  4.5 unx      133 bl defN 80-Jan-01 00:00 ./.requirements.zip
-rw-r--r--  4.5 unx      133 bl defN 80-Jan-01 00:00 .requirements.zip
-rw-r--r--  4.5 unx       27 bl defN 80-Jan-01 00:00 handler.py
-rw-r--r--  4.5 unx      602 bl defN 80-Jan-01 00:00 unzip_requirements.py
4 files, 895 bytes uncompressed, 499 bytes compressed:  44.2%

.requirements.zip gets included twice, once as ./.requirements.zip, once as .requirements.zip.

The cause of the issue:

When packaging individually, .requirements.zip gets included as {module}/.requirements.zip. So if module is not defined or set to ., it gets included as ./.requirements.zip.
And serverless does not seem to like such ./file patterns.

See issue: serverless/serverless#6164

The issue is probably not located in this repo, but I just wanted to raise it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions