Skip to content
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

Support on cache by body on POST request #115

Closed
leeboy1984 opened this issue Sep 15, 2022 · 6 comments
Closed

Support on cache by body on POST request #115

leeboy1984 opened this issue Sep 15, 2022 · 6 comments

Comments

@leeboy1984
Copy link

leeboy1984 commented Sep 15, 2022

Hi,

I'm getting "Internal Server Error" when I'm trying to configure a POST request.

Here is my function definition

postCached:
    handler: src/handlers/postCached.handler
    events:
      - http:
          path: /cached/test
          method: post
          cors: true
          caching:
            enabled: true
            cacheKeyParameters:
              - name: integration.request.header.bodyValue
                mappedFrom: method.request.body

And a body example:

{
  "email": "foo@bar.xyz"
}

What is wrong?

@DianaIonita
Copy link
Owner

Hi @leeboy1984,

Could you please check if your endpoint works when the caching plugin is not used? For example, you could remove it from the serverless.yml plugins section.

Thanks.

@leeboy1984
Copy link
Author

Yes! It works perfectly if I remove the cache config or remove the plugin

@DianaIonita
Copy link
Owner

Hi @leeboy1984,

Could you please try adding integration: lambda to your event?

For example:

events:
  - http:
      path: /cached/test
      method: post
      integration: lambda

@leeboy1984
Copy link
Author

No, if I add that type of integration somehow lambda is not getting executed, fails before even calling the handler

@leeboy1984
Copy link
Author

The error I'm getting from API Gateway is the following:
Execution failed due to configuration error: Unable to transform request

Any suggestion/idea?

@leeboy1984
Copy link
Author

I have found the problem, problem is related with binaryMediaTypes, if for any reason you have binaryMediaTypes: / lambda integration does not work

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

2 participants