Template format error: Number of resources, 202, is greater than maximum allowed, 200

Hi,

I recently got the above error message when doing an sls deploy. I’m guessing this is because I have a single Service Service with a lot of endpoints underneath it. To give you an example of the size my serverless.ymal is around 1000 lines of config. It defines many many endpoints for many lambdas which each include / exclude individual files. I created a single service because I have some code (Data Access Layer + Logic) that is shared between many lambdas.

My API is currently tiny compare to what the full production API will be. I guess I have to split it up in to several Serverless Services and upload each service. My question is, is there a way to share a lib between multiple services? or am I going to have to create a build script around this common library that gets deployed to each service (pretty much like npm install)?

Thanks,

Yes, if you’re after code sharing they you should use whatever module/package management tool your language (e.g. npm for node, etc), and just treat your separate Serverless servers as stand-alone applications (aka. microservices). This will ensure you can lock your code to specific versions, which will make upgrading shared functionality much easier in the future (trust me on this one).

If you need to share AWS resources (e.g. ARNs, etc) then you want the new cross-stack references. Each of your services will be their own CFN stack, and you can define your own outputs, and refer to them from other services.

1 Like