-
Notifications
You must be signed in to change notification settings - Fork 343
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
Query Parameter is only deserialized up to the first parameter and all the rest are left as None #802
Comments
can you access the |
I'm not sure how Axum transforms requests into Query struct, but I believe the runtime is generating the right |
I added tests in #803 that show that Axum can correctly extract the query parameters from our Requests objects. I noticed that Axum has two different versions of the extractors. I don't know which one you're using but the one in |
Thanks for the update, I'll be able to confirm this tomorrow. |
Here is what I have so far, I have a catch all route to try this out that looks like thi:
When invoking from the lambda test window with this json, I get no path params. I assume because lambda runtime has to interperet the json object into a url request
So this json payload results in 404 :
From Cloud ShellSince api gateway doesn't support testing since I just have a single resouce with
Removing the first query parameter leads
Maybe the +proxy from api gateway doesn't pass along all the query params? Screenshot of the proxy resource and api gateway |
I was playing around more with the lambda console and sending json payloads directly: This payload was interpreted correctly:
Adding two or three string query parameters was read into the lambda correctly as well. However, when trying to pass in a number as a query parameter, I got a lambda-runtime error:
Perhaps keeping numbers is intentional part of the lambda runtime... But I finally got the lambda function to work correctly when passing in the payload like this:
I this means that API Gateway is handling the request in a way we are not expecting. |
This is correct. Query string parameters MUST be string. This is definitely what API Gateway sends in normal circumstances if you send HTTP requests to the endpoint that it generates for you. What you're basically experiencing is that the Lambda console generates invalid payloads and sends them to the Lambda function directly. I've seen this happening before. We cannot do much about it unfortunately. To be honest, I have very little experience configuring API Gateway, so I cannot help you much. @bnusunny might know if that |
I believe this is not related to the runtime. I just deployed the axum example behind an APIGW rest api and it works just fine: I used the CDK stack in #807. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
I am using Axum rust to handle Query parameters in the URL within the runtime. The issue that I can't figure out is that the program will only deserialize the first query parameter. If there are two or more, then the second and third query parameters will be read as null.
When I invoke the api gateway, with next_key_a first, it will be read but next_key_b will be None. If i switch the query parameters, they will then change from Some to None
Calling
https://5oclxtbcq3.execute-api.us-east-1.amazonaws.com/test-stage/conversations?next_key_b=7e95e561-3b3f-4a82-954f-fb37f8c0f257&next_key_a=053baf43-ac9c-4754-a94a-de982c169204
will cause next_key_b to be Some() and next_key_a to be None.Then calling
https://5oclxtbcq3.execute-api.us-east-1.amazonaws.com/test-stage/conversations?next_key_a=7e95e561-3b3f-4a82-954f-fb37f8c0f257&next_key_b=053baf43-ac9c-4754-a94a-de982c169204
will be the opposite.I think it is something that happens before the payload from API Gateway hits the axum web server because I've tried a bunch of unit tests to make sure this struct can handle this from the url:
The text was updated successfully, but these errors were encountered: