RickyBelmont
RickyBelmont

Reputation: 639

Right syntax for multiple input event params in AWS Lambda NodeJS

Can anyone help me correct with this code in Lambda Nodejs with multiple input event params.

I've tried already the following but no luck!

ABC = ? WHERE XYZ = ?;', event['ABC', 'XYZ'], function (error, results, fields)

ABC = ? WHERE XYZ = ?;', event['ABC']['XYZ'], function (error, results, fields)

ABC = ? WHERE XYZ = ?;', event['ABC'], event['XYZ'], function (error, results, fields)

Upvotes: 0

Views: 147

Answers (1)

Chris Williams
Chris Williams

Reputation: 35258

The correct syntax that you should be using is below.

By doing this you're providing them as a list.

event['ABC', 'XYZ'] is not valid syntax.

event['ABC']['XYZ'] is looking for a XYZ key inside of event['ABC'].

event['ABC'], event['XYZ'] is passing in to many parameters.

ABC = ? WHERE XYZ = ?;', [event['ABC'], event['XYZ']], function (error, results, fields)

Upvotes: 1

Related Questions