serverless / serverless-plugin-typescript

Serverless plugin for zero-config Typescript support
MIT License
784 stars 224 forks source link

Deployed lambdas have a `.build` prefix in the handler path #268

Closed lucaspiller closed 2 years ago

lucaspiller commented 2 years ago

I've got a weird issue: When new Lambdas are created, the handler path is prefixed with .build. There is no .build folder in the uploaded zip though, so when the Lambda is ran, it results in an error:

{
  "errorType": "Runtime.HandlerNotFound",
  "errorMessage": ".build/src/handlers/<snip>/index.handler is undefined or not exported",
  "stack": [
    "Runtime.HandlerNotFound: .build/src/handlers/<snip>/index.handler is undefined or not exported",
    " at Object.module.exports.load (/var/runtime/UserFunction.js:246:11)",
    " at Object.<anonymous> (/var/runtime/index.js:43:30)",
    " at Module._compile (internal/modules/cjs/loader.js:1085:14)",
    " at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
    " at Module.load (internal/modules/cjs/loader.js:950:32)",
    " at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
    " at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)",
    " at internal/main/run_main_module.js:17:47"
  ]
}

Screenshot 2022-03-22 at 16 34 09

Screenshot 2022-03-22 at 16 31 24

If I remove the .build prefix on the AWS console everything works perfectly, and if I redeploy it doesn't revert it back.

Any ideas what happened here?

Versions:

lucaspiller commented 2 years ago

I dug into the code, and it's actually caused by serverless-plugin-localstack which doesn't work with this plugin.