byrage byrage - 1 month ago 9
Node.js Question

How can extract special character parameter in AWS Lambda?

I am testing AWS Lambda by Node.js 4.3.
when I request POST method in start with special character Parameters.

{
"@type": "Test"
}


then print log is normally working, but Lambda dose not recognize '@type' params.

exports.handler = (event, context, callback) => {
console.log(event);
var type = event.@type;
callback(null, type);
};


How can I fix it?

Answer

You could always use the non-groovy hipster syntax:

event["@type"]