Skip to content

Example has disappeared? #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RandomInsano opened this issue May 31, 2020 · 11 comments
Closed

Example has disappeared? #232

RandomInsano opened this issue May 31, 2020 · 11 comments
Labels
bug Something isn't working

Comments

@RandomInsano
Copy link

The sentence "The code above is the same as the basic example in the lambda-runtime crate." in the readme contains a dead link.

I dug around a little and didn't find anything that obviously matches.

@softprops
Copy link
Contributor

Sorry about that.

It's not that it's disappeared is that the readme reflects documentation for the released version while the state of the code base reflects the state of the next version. This should get cleaned up for the next release but until then you can browse the source under the v0.2.0 git tag. Here's the example you have have been looking for

https://github.com/awslabs/aws-lambda-rust-runtime/blob/v0.2.0/lambda-runtime/examples/basic.rs

@rimutaka
Copy link
Contributor

rimutaka commented Jun 17, 2020

Was v0.2.0 code used for the published crate, which is listed as 0.2.1?
https://docs.rs/lambda_runtime/0.2.1/lambda_runtime/index.html

I'm trying to find the implementation of lambda! macro, but it looks like you got rid of it in the latest unpublished version. I couldn't find any traces of its implementation in the older code either. Apologies for this dummy question. I'm new to Rust.

@softprops - can you point me in the right direction?

@brainstorm
Copy link

@rimutaka New to Rust here too. If you want to take a peek at some code that mostly works with master (at the time of writing this), take a peek at this branch (WIP) brainstorm/s3-rust-htslib-bam@0b9fb02... I'm currently struggling a bit locally with the IntoResponse type (in the middle of a local code refactor):

error[E0277]: the trait bound `http::response::Response<serde_json::value::Value>: lambda_http::response::IntoResponse` is not satisfied
  --> src/main.rs:29:59
   |
29 | async fn bam_header(event: Request, _: Context) -> Result<impl IntoResponse, Error> {
   |                                                           ^^^^^^^^^^^^^^^^^ the trait `lambda_http::response::IntoResponse` is not implemented for `http::response::Response<serde_json::value::Value>`
   |
   = help: the following implementations were found:
             <http::response::Response<B> as lambda_http::response::IntoResponse>
   = note: the return type of a function must have a statically known size

But both the example code from that branch as well as the master branch should work right out of the box.

That code should give you an idea/example about how to proceed in the interim, as @softprops polishes his changes and things like SAM CLI gets upstreamed (fingers crossed). That SAM CLI stuff should make the deployment steps way easier and (hopefully) deprecate my adhoc AWS CDK script.

@softprops
Copy link
Contributor

softprops commented Jul 14, 2020

Re IntoResponse. Try just returning the serde value.

Re sam cli: it's been a frustrating ride sheparding that along. The sam team have some trepidation due to some design issues with sam itself today with the provided runtime in particular which may cause long term support hassle for them. Don't get your hopes up yet because mine are slowly dieing!

@brainstorm
Copy link

Argh, thanks for telling, I need to catch up and review on that and see if I can help somehow :-S

@rimutaka
Copy link
Contributor

Actually, the examples, ReadMe and crate docs are a bit out of sync.

  1. Links to non-existent examples:
  1. The main example in ReadMe only exists in the ReadMe and not as an example .rs file.
  2. None of the examples use lambda! macro - is there a reason for that? Is it to be deprecated?
  3. Looks like lambda! macro is defined in https://github.com/awslabs/aws-lambda-rust-runtime/blob/master/lambda-attributes/src/lib.rs, but ReadMe refers to lambda-runtime.
  4. There is no crate docs in the above file.
  5. lambda-runtime-client should probably refer to https://github.com/awslabs/aws-lambda-rust-runtime/blob/master/lambda/src/client.rs ?

I suspect that the absolute majority of users want a stable runtime, examples how to use it and no desire to modify the source.
I can try porting some of my lambdas into examples in the next few days and updating the ReadMe.

Cross-ref: #216

@brainstorm
Copy link

If you want a non-master working example, take this one from the past Rust Weekly newsletter:

https://github.com/knoldus/AWS-Lambda-With-Rust

... but that one breaks on master, so shouldn't be used as an example, IMO.

@voteblake
Copy link
Contributor

@andresv posted a blog last week using this library from master - I don't see a license attached directly but if he's agreeable to contribute these could also make for good examples:
https://andres.svbtle.com/passing-messages-between-aws-iot-and-sqs-queue-using-lambdas-written-in-rust

@andresv
Copy link

andresv commented Jul 14, 2020

Yes, please use them :)

@brainstorm
Copy link

brainstorm commented Jul 14, 2020

@rimutaka Feel free to use my repo as well for a domain-specific bioinformatics example, it works now with master too:

https://github.com/brainstorm/s3-rust-htslib-bam

@jkshtj jkshtj added the bug Something isn't working label Jan 21, 2021
@coltonweaver
Copy link
Contributor

These issues were fixed in two previous PRs, I'm going to close this issue. Please feel free to re-open if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants