Hey Guys,
Ran into a little issue when I tried to POST a JSON payload to serverless-offline that was an array rather than a dictionary as the top level. Outputting the event, the relevant body attribute in serverless-offline outputs:
body: '{"[{"uid":"1418542617","queue_name":"LG-SQS"}]":""}',
However, running serverless on API Gateway with the same request yields:
body: '[{"uid":"1418542617","queue_name":"LG-SQS"}]
As you can see, serverless-offline is trying to parse the json as a dict rather than an array.
Thanks @imackinn, I was able to reproduce and will work on it (but please anyone PR if they need it fixed sooner)
I'm not working on this right now sorry u_u. Relates to #173
Hi @dherault, I tested it locally and couldn't reproduce the issue. I created a POST handler and sent it this payload as described by @imackinn
[{"uid":"1418542617", "queue_name":"LG-SQS"}]
In serverless-offline I got body: [ { uid: '1418542617', queue_name: 'LG-SQS' } ] correctly parsed.
I'm running the latest version from master.
Did I understand correctly the problem? or could it have been solved in the latest version?
Cheers.
Thanks @ansraliant for your input.
@imackinn do you still encourter the issue? If yes can you tell us more about your setup?
@dherault just tried with 3.8.3 and it's parsing the json-array payload correctly. Thanks everyone.
Most helpful comment
@dherault just tried with
3.8.3and it's parsing the json-array payload correctly. Thanks everyone.