So, it looks like you might have several problems. First, avoid using the name "name" as the name of a variable. Secondly, the data is probably not being processed correctly. You need JSON.Stringify when you submit it (yes, you already have JSON, but this is elusive):
$.ajax({ url: 'https://mylambdafunctionurl/', type: 'POST', crossDomain: true, contentType: 'application/json', data: JSON.stringify(data), dataType: 'json', success: function(data) {
I also added crossDomain: true and contentType: 'application / json'.
In the lambda function, to get the key / value in the passed to JSON, you simply use event.whateverkey (when using a test event in the Lambda console, the keys correspond to what you send in order to avoid any problems).
The data in your success callback in your ajax function is what is returned from the lambda function, so I recommend JSON.stringify that in the lambda function, not success, to make sure it is sent correctly:
context.done(null, JSON.stringify({"Hello":name}));
source share