iopipe / serverless-iopipe-layers

Please migrate to the equivalent New Relic Serverless plugin: serverless-newrelic-lambda-layers
https://github.com/iopipe/serverless-newrelic-lambda-layers
Apache License 2.0
14 stars 8 forks source link

Error in combination with serverless-plugin-warmup #8

Closed stevecaldwell77 closed 5 years ago

stevecaldwell77 commented 5 years ago

When I include serverless-plugin-warmup in my list of plugins along with serverless-iopipe-layers, an extra lambda function is created by the warmup plugin that then fails with:

Unable to import module 'iopipe_wrapper': Error
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
kolanos commented 5 years ago

@stevecaldwell77 Thanks for the bug report.

Do you have any package or function related exclude or include directives? Can you prrovide a serverless.yml that reproduces the problem?

kolanos commented 5 years ago

Reading the serverless-plugin-warmup docs here: https://github.com/FidelLimited/serverless-plugin-warmup

It looks like the plugin excludes all files other than it's own by default:

package (default package: { individually: true, exclude: ['**'], include: ['_warmup/**'] })

Try a setting like this:

package: { individually: true, exclude: ['**'], include: ['_warmup/**', 'iopipe_wrapper.js'] }

Let me know if that fixes it for you. Will create an issue to set include automatically in this case.

stevecaldwell77 commented 5 years ago

@kolanos - that got it to work, thank you so much!

kolanos commented 5 years ago

@stevecaldwell77 We just released v0.2.0. This version should no longer require you to override serverless-plugin-warmup's package config.

stevecaldwell77 commented 5 years ago

@stevecaldwell77 We just released v0.2.0. This version should no longer require you to override serverless-plugin-warmup's package config.

@kolanos - works perfectly, thanks!