juanjoDiaz / serverless-plugin-warmup

Keep your lambdas warm during winter. ♨
MIT License
1.11k stars 115 forks source link

feat: include generated files for serverless dashboard in package pattern #314

Closed yezarela closed 2 years ago

yezarela commented 2 years ago

When enabling serverless dashboard in the yml file by specifying org and app, by default serverless will wrap our lambda functions and add serverless_sdk to our lambda function, which then results for example:

image

_Note: smain.js comes from `s$fnname.js`

But, since serverless-plugin-warmup by default only includes warmup/${warmerName}/** in the package pattern, the files generated for serverless dashboard will not be included when packaging the lambda (which then results error due to missing files).

image

As we can see in the generated cloudformation file, the handler path is modified to the wrapped one:

image

Current workaround for this, is by specifying the generated files in package pattern:

warmup:
  enabled: true
  prewarm: true
  package:
    patterns:
      - './serverless_sdk/**'
      - './s_warmUpPluginDefault.js'

But I think would be better if those files are included by default, and this little PR will do that.

Would like to hear any feedback! Thank you

juanjoDiaz commented 2 years ago

That's for the PR.

Reviewing this lead my to find the actual issue with is in Serverless Dashboard Plugin. I created a PR on their end and now I'm waiting for it to be accepted. Please see #310 to follow up on this issue.