softprops / serverless-rust

⚡ 🦀 a serverless framework plugin for rustlang applications
https://www.npmjs.com/package/serverless-rust
MIT License
542 stars 82 forks source link

Support invoke/local #9

Closed softprops closed 5 years ago

softprops commented 5 years ago

add support for serverless invoke local -f function-name

softprops commented 5 years ago

while looking into this it seems very possible at the outset but now seems blocked by a conflict in what rust crowbar expects in a provided context and what is provided by serverless' fake invoker context namely to properties would need to be added to serverless's provided context log_group_name and log_stream_name. Aws' documentation for its python runtime does have a complete list of attributes but mentions log_stream_name may be None if the lambdas role doesn't have permission to write logs but is less clear about log_group_name. It should be relatively straightforward to add these to serverless's invoke harness. so we may want to open an issue there and get feedback on what a patch may look like.

In addition serverless's invoke conext returns an memory_limit_in_mb as an in where crowbar assumes a str. Since crowbar works in production aws its likely its represented as a string and should be with serverless invoke context for consistency.

It's also work taking note that crowbar has its own fake invoke context for testing that we may want to reference for comparison

softprops commented 5 years ago

this seems to be blocked by some misalignment with the python context in serverless. I've opened pr to address there https://github.com/serverless/serverless/pull/5291

softprops commented 5 years ago

1.33 of severless framework was just released which should now make invoke local possible

softprops commented 5 years ago

closing to reopen for the new serverless runtime

ajmwagar commented 5 years ago

Doesn't work for me on Serverless 1.38.0.

Using your serverless-aws-rust template.

serverless invoke local -f hello -d '{"foo":"bar"}'
Serverless Error ---------------------------------------

  You can only invoke Node.js, Python, Java & Ruby functions locally.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           10.15.3
     Serverless Version:     1.38.0

Maybe reopen?

ajmwagar commented 5 years ago

Oops. I didn't see #20.

Thanks, Google. :/

Please disregard.