Bug Report
I'm using AWS as a cloud provider. I created a serverless project with the NodeJS Typescript template to use Lambda Layers. Service only contains the layer details in the serverless.yml file. When I'm trying you to package it, it's throwing an error called entry can't be non-empty value. So I checked the serverless-webpack npm module. It seems it's only generating entries for the Lambda functions not for the layers. I modified the validation and generated the entries for layers as well in the npm library and pointed the entry as database/nodejs/node-modules/database/index.ts in the tsconfig.json file Then it's successfully packaging the layer.
For bug reports:
Ts files are not getting compiled with the given folder structure. ASW have their folder structure to create lambda layer https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html. I followed the same structure
My folder structure: database/nodejs/node-modules/database/index.ts
(index.ts contains the typescript code).
The generated folder structure under .serverless folder is database.zip which contains (database/nodejs/node-modules/database/index.ts). This code has not complied. Seems it's just zipping the folder. If I use the mongoose npm library then the compiler is not resolving the file and it's throwing an error saying module is not resolved. But the file is there. under the node module.
The expected folder structure is database.zip which contains (database/nodejs/node-modules/database/index.js). index.js is a complied version of index.ts
For feature proposals:
Similar or dependent issue(s):
This is my folder Stucture.
This is the ts file
This is the
I am facing the similar issue while using AWS Lambda layers with TypeScript
I've seen workarounds but is there any update on this issue officially?
Im facing the same issue. Is there any workaround?
Same issue here.
Is there any chance to have a repo with minimal information to reproduce the issue?
Is there any chance to have a repo with minimal information to reproduce the issue?
I created a small repo to reproduce it: https://github.com/chriszirkel/serverless-webpack-layers
If you npx sls package it, the resulting testLayer.zip will contain the original index.ts Typescript file.
Most helpful comment
I've seen workarounds but is there any update on this issue officially?