Skip to content

Unable to serverless package when no lambdas exist #503

Open
@trend-adam-kinnell

Description

@trend-adam-kinnell

Describe the bug
When attempting to create a serverless package without any lambdas (and therefore code for esbuild to compile), the package step fails with an error Error: ENOENT: no such file or directory, lstat 'PATH_TO_REPO/.esbuild/.serverless'

It seems to be looking for the .serverless folder in the wrong place (within the .esbuild folder).

To Reproduce

  1. Create a new empty repo and install serverless, esbuild, and serverless-esbuild.
  2. Use the following minimal serverless.yml file that doesn't define any lambdas.
service: test
frameworkVersion: ^3

plugins:
  - serverless-esbuild

provider:
  name: aws
  runtime: nodejs18.x
  1. Run serverless package
  2. See error message Error: ENOENT: no such file or directory, lstat 'PATH_TO_REPO/.esbuild/.serverless'

Expected behavior
If there are no lambdas to package then serverless-esbuild does no work and the package step succeeds.

Screenshots or Logs
image

Versions (please complete the following information):

  • OS: Mac OSX Ventura 13.4.1 (22F82)
  • Versions:
    "esbuild": "0.19.4",
    "serverless": "^3.35.2",
    "serverless-esbuild": "1.48.5"

Additional context
This issue was introduced in [email protected] as it's the first version that shows this behaviour.

We try to install a base set of plugins across multiple repos - even those which are purely infrastructure/CloudFormation with no code. While esbuild and this plugin is not required in this repo and does not provide any benefit, we would still expect it to not cause any issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions