How to make a requirements.txt file per function in Serverless framework?


In my Serverless application i have 2 Lambda Python functions and each one has some package requirements. I followed this article to create the requirements.txt file.

However in deployment i ended with the 2 functions having the packages listed in requirements.txt while only one should have them.

This is the structure of the app :

- my-app
  - node_modules
  - venv
  - function1
  - function2

How to manage to make requirements.txt only be applied to 1 function and not the other one ?


You should use module and put requirement.txt to function folder that needed it.
example if function1 needs requirement

   module: function1