Code Monkey home page Code Monkey logo

Comments (5)

leandrodamascena avatar leandrodamascena commented on September 14, 2024

Hi @Dilski! Thanks for opening this potential bug.

I'm working to reproduce this error and will update this issue as soon as I have an update.

from powertools-lambda-python.

Dilski avatar Dilski commented on September 14, 2024

@leandrodamascena just for extra info, we were doing this with a private API gateway and so tested with test invoke on the console

from powertools-lambda-python.

leandrodamascena avatar leandrodamascena commented on September 14, 2024

@leandrodamascena just for extra info, we were doing this with a private API gateway and so tested with test invoke on the console

This was the missing piece of this puzzle! I could not reproduce this either in my local environment or on the Swagger/Public/Private endpoint. However, using the APIGW "Test" on the console I was able to reproduce it.

This is a very specific bug and thanks a lot for catching and reporting this. Testing your APIs thought AWS Console it will send to Lambda the exact string you added in the Headers section, and in this case the string is:

"headers": {
    "Content-Type": " application/json"
},
"multiValueHeaders": {
    "Content-Type": [
        " application/json"
    ]
},

If you see, there is a space before the application/json string and it fails in this line. It looks like the solution is to remove the spaces before checking the header, something like this if not content_type_value or content_type_value.strip().startswith("application/json"):. While we create a PullRequest and release a version to fix this, you can test using the header with no space between key and value: Content-Type:application/json.

We are planning to release a version on February 8th. Please let me know if it is enough for you to wait until then or need this fix immediately.

Thanks.

from powertools-lambda-python.

github-actions avatar github-actions commented on September 14, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

from powertools-lambda-python.

github-actions avatar github-actions commented on September 14, 2024

This is now released under 2.33.0 version!

from powertools-lambda-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.