You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Path parameter is decoded within the SpringBootLambdaContainerHandler proxy method before it reaches Application's Rest controllers #621
To help us debug your issue fill in the basic information below using the options provided
Serverless Java Container version: 1.9.2
Implementations:Spring Boot
Framework version:SpringBoot 2.7.14
Frontend service:REST API
Deployment method:Serverless Framework
Scenario
Describe what you are trying to accomplish
When we make an api call to the java lambda, we expect the path to be passed in through the handler as is to reach my springboot application's rest controller, extract whatever path parameters are configured and service the request
Expected behavior
Describe how you would expect the application to behave
We expect the SpringBootLambdaContainerHandler to pass the path as is to the application's rest controller to process and perform business as usual functionality
Actual behavior
Describe what you are seeing instead
When we pass a path with an encoded value through the handler method, it will decode the entire path including the encoded value before passing it into my application's rest controller. My application then gives me an internal server error because the encoded value is now decoded when passed to the rest controller, and because the value has a slash in it, the path variable mapping will break.
Steps to reproduce
Unable to provide code sample/logs due to nature of enterprise work
Full log output
Paste the full log output from the Lambda function's CloudWatch logs
Hi @jjuncho. Could you provide an example of a path with an encoded value? We use the Jackson library to deserialize the Json from the input stream into a request class. The decoding is just part of that process.
@jjuncho Not yet. I'm actively working on it. One question: Is /path?query=%25encoded%24 a good example path to reproduce the issue? That's what I used, I just want to make sure.
@jjuncho I found what the issue is and I'm working to solve it. But first I would like to confirm the behavior you're looking to get. Do you expect /path/%25encoded%25/smth to reach your controller exactly as-is, or do you want the %25 parts to be decoded (/path/%encoded%/something? Please let me know
@jjuncho After more research, it turns out that the path comes already decoded by APIGateway, so it's out of our control. We also found that the query string parameters are passed as-is, so maybe as a workaround you could use that instead of the path parameters.
Activity
mbfreder commentedon Aug 16, 2023
Hi. Thanks for raising the issue. We are taking a look.
mbfreder commentedon Aug 17, 2023
Hi @jjuncho. Could you provide an example of a path with an encoded value? We use the Jackson library to deserialize the Json from the input stream into a request class. The decoding is just part of that process.
mbfreder commentedon Aug 17, 2023
I managed to reproduce the issue. Trying to find the root cause.
jjuncho commentedon Aug 22, 2023
@mbfreder any updates?
mbfreder commentedon Aug 22, 2023
@jjuncho Not yet. I'm actively working on it. One question: Is /path?query=%25encoded%24 a good example path to reproduce the issue? That's what I used, I just want to make sure.
jjuncho commentedon Aug 22, 2023
That works too, I was using more of a /path/%25encoded%25/smth usecase
mbfreder commentedon Aug 29, 2023
@jjuncho I found what the issue is and I'm working to solve it. But first I would like to confirm the behavior you're looking to get. Do you expect /path/%25encoded%25/smth to reach your controller exactly as-is, or do you want the %25 parts to be decoded (/path/%encoded%/something? Please let me know
mbfreder commentedon Sep 11, 2023
@jjuncho After more research, it turns out that the path comes already decoded by APIGateway, so it's out of our control. We also found that the query string parameters are passed as-is, so maybe as a workaround you could use that instead of the path parameters.