Nopik / serverless-serve

Local lambda HTTP serve plugin for Serverless framework, a.k.a. API Gateway simulator.
119 stars 19 forks source link

in `_registerLambdas`, `fun.runtime` is undefined #14

Closed modulitos closed 8 years ago

modulitos commented 8 years ago

There is a check in the _registerLambdas function where we iterate through all of the lambda functions fun, and then we check if ( fun.runtime == 'nodejs' ) { to register the lambda. For some reason, fun.runtime is undefined, so none of our lambdas are getting registered.

Perhaps this was a breaking change in a Serverless update? Or maybe we can update the documentation to describe how someone can define their lambda's fun.runtime field?

martinmicunda commented 8 years ago

I have same problem. The plugin is looking at function level to check for runtime but instead it should look at component level (the runtime is defined in s-component.json).

boaf commented 8 years ago

My workaround was to utilize Function.getRuntime(): boaf/serverless-serve@9b51091a61b26f6b147e1fa3584806053c5ead81

In fact, it looks like this may become the officially-supported way of getting the runtime. See ryansb/serverless@9f1c57fd0f976cf4f3d3821d253c3615417129d0

martinmicunda commented 8 years ago

The Function.getRuntime() solution works for me. Thanks