Sls deploy and sls offline with Multiple Serverless.yml in a project

cloudformation
lambda
aws
#1

My serverless project was structured like this before,

├── serverless.yml
├── package.json
├── node_modules
├── test
├── src
    ├── handler.js
    ├── function1
          └── function1.js
    └── function2
          └── function2.js

commands sls invoke test, sls offline, sls deploy works fine
This structure was perfect until CloudFormation's 200 Resource Limit error.

I changed the structure to have multiple serverless.yml file as suggested here: https://serverless.com/blog/api-gateway-multiple-services/

├── package.json
├── node_modules
├── test
├── src
    ├── function1
          ├── serverless.yml
          ├── handler1.js
          ├── function1A.js
          └── function1B.js
    └── function2
          ├── serverless.yml
          ├── handler2.js
          ├── function2A.js
          └── function2B.js

The problem now I have is, I will have to deploy sls deploy the functions individually. sls offline have to be run on different ports.
Even then, the problem doesn’t solve.
How can I run these function with the offline plugin and also deploy in single command?

0 Likes

#2

Hey there, have you found a solution for it? I am looking for the solution using webpack and share common data between the serverless files…

Thanks

0 Likes

#3

Yes I did. I restructured my application as I mentioned.
Used webpack, babel to share common resource. Works perfect for me.
You can Refer This

0 Likes