Serverless package size inconsistent when project is inside a GUID-named folder (50MB vs 1MB)

Environment:

  • Serverless Framework version: 3.39.0

  • Node.js version: 22.x

  • OS: Windows Server

  • npm version: 10.8.3

Setup: We’re deploying Lambda functions using Octopus Deploy + TeamCity. Octopus automatically creates a temporary working directory with a GUID as the folder name for each deployment.

Example paths:

  • GUID folder: C:\Octopus\Work\2b046a8c-de00-4177-96b1-aff635522059\auth-lambda

  • Normal folder: C:\Projects\auth-lambda

Commands:

bash

npm i --omit=dev
npm i serverless
serverless deploy -s stageName

Issue: The same project with identical code produces vastly different package sizes depending on the parent folder name:

Folder Type Package Size
GUID-named folder ~50MB
Normal folder ~1MB

No changes to code, dependencies, or configuration — only the folder name differs.

Steps to reproduce:

  1. Create a simple Serverless project

  2. Copy it into two locations — one with a GUID folder name, one without

  3. Run npm i --omit=dev && npm i serverless && serverless package in both

  4. Compare .serverless/*.zip sizes

Workaround: Using npx serverless package Instead of installing serverless locally, it avoids the issue.

Question: Is this a known issue with how Serverless Framework resolves paths or package dependencies? Could the hyphens, length, or alphanumeric pattern in the GUID folder names be triggering unexpected behavior?

Any insights or suggestions would be appreciated.