Skip to content

Fails when used with httpApi gateway #212

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
MarcoPolo opened this issue Mar 15, 2020 · 7 comments
Closed

Fails when used with httpApi gateway #212

MarcoPolo opened this issue Mar 15, 2020 · 7 comments

Comments

@MarcoPolo
Copy link

When using a lambda with HTTP API Gateways it fails to parse the incoming event. I think it's because http apis don't pass a resource id, so the deserializing fails. Maybe something like this would fix it: MarcoPolo@b0091cb?

You can repro by using something like the following in a serverless.yml config:

...
functions:
  fooFn:
    handler: fooHandler
    events:
      - httpApi:
          path: /
          method: GET
@davidbarsky
Copy link
Contributor

Yeah, I'm sorry about that this not working and for the delay in responding. The API Gateway HTTP APIs introduced a new format for HTTP requests and responses which will require some work to properly support, beyond just the resource ID change. Beyond the changing the format in serde, the multivalue headers map has gone away (https://aws.amazon.com/blogs/compute/building-better-apis-http-apis-now-generally-available/?nc1=b_rp), which makes parsing some headers harder to do correctly. I've been trying to avoid thinking too hard about it :P

@softprops
Copy link
Contributor

I've been MIA for a while I'd be interested in picking this up again. I also noticed there's a v2 req/resp format. I can do some exploration on this

@MarcoPolo
Copy link
Author

Nice! Let me know if there's anything I can do to help

@ajpauwels
Copy link

ajpauwels commented Apr 12, 2020

Does anyone know of the best way to get around this for now? And does it affect REST-type endpoints?

@softprops
Copy link
Contributor

@MarcoPolo wanted to keep you updated. Progress is being made
#217

@ajpauwels It depends on what version you are using. Api gateway REST API and ALB triggers are known to work. API gateway HTTP APIs are not yet but will soon be supported. See link above. In the meantime, you can always define a custom deserializable for all trigger types for a fallback.

@dbcfd
Copy link

dbcfd commented Jul 1, 2020

Using master, I just define a lambda::Handler, receive the json value, and deserialize using aws_lambda_events. I then process it and serialize it back to json so it works with handler.

Works well with Http api.

@coltonweaver
Copy link
Contributor

Looks like the PR that addresses this was merged in very recently. Let us know if that presents issues. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants