Shared Handlers

In using the Serverless framework, is it possible to have shared handlers?

If you have multiple domains and there are some handlers that are shared across those domains, how would you reference them within the servlerless.yml file? We have common handlers where their functionality is different based on parameters passed in through the environment section of the serverless.yml file but cannot figure out how to reference them correctly through the serverless.yml file, more specifically, the handler entry.

I have tried entries such as:

  handler: common/common_retrieve.retrieve

and the directory structure looks like this


  serverless.yml <- retrieveFoo defined here

However, this does not seem to work.

I took a look at Function handler from folder outside project but there was no joy there, I would receive an error stating: No matching handler found for ‘common/common_retreive’ when I did a ‘serverless deploy’.

1 Like

Got the same question!..