serverless-esbuild icon indicating copy to clipboard operation
serverless-esbuild copied to clipboard

Fails when local invoke runs with Docker

Open serkan-ozal opened this issue 3 years ago • 0 comments

Describe the bug When Serverless local invoked on Docker, esbuild plugin fails with the following error:

TypeError: Cannot destructure property 'result' of 'this.buildCache[entry]' as it is undefined.
    at bundleMapper (/Users/serkan/Documents/workspace/hello-world-ts-es-build/node_modules/serverless-esbuild/dist/bundle.js:64:21)
    at /Users/serkan/Documents/workspace/hello-world-es-build/node_modules/p-map/index.js:57:28
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

To Reproduce

I have the following serverless.yml:

service: hello-world-es-build

frameworkVersion: "3"

custom:
  esbuild:
    bundle: true
    minify: false
    sourcemap: true

provider:
  name: aws
  runtime: nodejs14.x
  region: eu-west-2

functions:
  hello:
    handler: src/handler.hello
    timeout: 120

plugins:
  - serverless-esbuild

package:
  individually: true

and then run sls invoke local --function hello --docker

Expected behavior Serverless local should be able to invoked and run in Docker successfully and return the following result:

{
    "statusCode": 200,
    "body": "{\n  \"message\": \"Your function executed successfully!\",\n  \"input\": \"\"\n}"
}

Versions (please complete the following information):

  • OS: MacOS Monterey 12.0.1
  • Serverless Framework Version: 3.24.1
  • Plugin Version: 1.33.1

serkan-ozal avatar Nov 11 '22 14:11 serkan-ozal