Closed robhorvath closed 8 years ago
What does your VM template look like?
I'm using the default one that's part of serverless-offline.
#define( $loop )
{
#foreach($key in $map.keySet())
"$util.escapeJavaScript($key)":
"$util.escapeJavaScript($map.get($key))"
#if( $foreach.hasNext ) , #end
#end
}
#end
{
"body": $input.json("$"),
"method": "$context.httpMethod",
"principalId": "$context.authorizer.principalId",
#set( $map = $input.params().header )
"headers": $loop,
#set( $map = $input.params().querystring )
"query": $loop,
#set( $map = $input.params().path )
"path": $loop,
#set( $map = $context.identity )
"identity": $loop,
#set( $map = $stageVariables )
"stageVariables": $loop
}
Would it be possible for you to provide a test project.zip (simplified with one function) that produces the error? Only your code files of course.
I've narrowed down the issue. I created an empty hello world service, which works fine. So I then looked at my project, and figured out that if I use a tool like Insomnia to request my endpoint, I get the error. If I request it via Chrome, it works.
I think it may come down to Content-Type
in the requests being different between those environments. Insomnia is requesting application/json
.
Further update - it's a tooling issue. Postman requests work fine. I'll need to troubleshoot the issue on my end for Insomnia. Thanks for your help!
Using serverless 1.0.0-beta.2 and the latest serverless-offline v1 branch, I receive this error on every request. Any ideas?