Skip to content

Serverless function archives built on Windows include binaries cache from node_modules/.cache #6670

Closed

Description

@janpio

Bug description

When building a serverless function archive on Windows manually of via Serverless Framework (deploy or package) it is easy to create far to big archive, as the node_modules/.cache folder is included by default.

From an unpacked Serverless framework archive:

C:\USERS\JAN\DOCUMENTS\PRISMA2-E2E-TESTS\PLATFORMS-SERVERLESS\SERVERLESS-LAMBDA\.SERVERLESS\E2E-TESTS-SERVERLESS-LAMBDA\NODE_MODULES\.CACHE
└───prisma
    └───master
        └───c5bee99a3abae3004e266533d9ffcd619c9b1264
            ├───rhel-openssl-1.0.x
            │       query-engine
            │       query-engine.gz.sha256
            │       query-engine.sha256
            │
            └───windows
                    query-engine
                    query-engine.gz.sha256
                    query-engine.sha256

This example is unpacked 72 MB in this example.


To visualize the impact this can have on the archive, see this comparison of the generated archives for our e2e-tests serverless example:
image


This behavior is not present on other operating system as we do never store the cache files in node_modules there, but other locations outside the project:
https://github.com/prisma/prisma/blob/14ffd0093c1b8c7db1f45e9f04c5fab7c1c120d2/src/packages/fetch-engine/src/util.ts#L12-L32
https://github.com/prisma/prisma/blob/14ffd0093c1b8c7db1f45e9f04c5fab7c1c120d2/src/packages/fetch-engine/src/download.ts#L482

Expected behavior

We want to achieve a happy path for users where the cache is not included in the archive by default.

Possible options:

  1. Documentation on how to exclude this folder
  2. We store the data in some other location in the first place (e.g. by changing the order of possible locations for Windows)

Prisma information

2.22.0-dev.18

Activity

  1. added
    bug/1-unconfirmed
    kind/bug
    on Apr 20, 2021
  2. added
    bug/2-confirmed
    and removed
    bug/1-unconfirmed
    on May 16, 2021
  3. pantharshit00 commented on May 16, 2021

    @pantharshit00
    Contributor

    I can also reproduce this.

  4. added a commit that references this issue on Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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