-
-
Notifications
You must be signed in to change notification settings - Fork 797
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
JSON using VTL different between serverless on API Gateway vs offline #50
Comments
Hi @alshamma, you've just pointed out the plugin's main issue! This is due to the difference of implementation between the Java Velocity parser AWS uses and the JavaScript Velocity parser we use (an external library). To fix your issue one should call JSON.stringify on each velocity output, put this raises issues too. I'll keep this one open as a reminder. |
I just ran into this issue as well. Assuming
But on AWS the text is still rendered... Then I tried:
Which works on AWS, but throws an error offline... I also tried:
Which worked offline but not on AWS. |
I found a workaround on this page that seems to work the same between AWS/Offline:
But this is kind of ugly... |
+1 |
any update? |
@alireza8101 do you have some repro code about the issue? |
unfortunately no |
I am using this construct in my s-templates.json as part of my requestParameters:
When I call my API from API Gateway, my Lambda receives the params as a string, and I have to call JSON.parse on the string.
When I call my API from serverless-offline, my Lambda receives the params as an object (which I actually prefer).
Would be great if both returned the same response, which I guess means offline should match API Gateway/Lambda.
The text was updated successfully, but these errors were encountered: