AWS Lambda Layers :: How to add and require a simple js file from a lambda layer

In my serverless project, I have some js files that are being repeated among several lambdas functions, and I want to add theses files inside my lambda layer and use them as a simple require() inside each lambda function.

I am already using a lambda layer to share npm packages among lambdas, and it is working as expected, with the structure: nodejs/node_modules/{package-name}/

But I dont want to transform my simple files into a private npm package to make it work.

I’ve tried to create a new folder inside nodejs folder, called /custom_libs

So my attempt is nodejs/custom_libs/lib-name.js and the require inside lambda function is:


But it is not working.

Any thoughts on how can I achieve this ?