I am trying to send, two calls using different urls ( they are not concurrent calls, first one will execute at first and after that second one can execute ). I am using Node 8 and using the request-promise library to have this executed. ( Everything happens in google cloud function ). The problem is, when there was only one url to execute, it worked fine. But when I added the second one, now both of the post requests is not working.
Here is my code:
const confirmSms = {
method: 'POST',
uri: '.....',
body: {
quantity
},
json: true
};
const options = {
method: 'POST',
uri:`....`,
body: {
amount
},
json: true
};
And, I am using async / await also. Now, how I executed is, this is the code :
For the first one :
await rp(confirmSms)
For Second One :
await rp(options)
Am I doing this correctly? What's wrong, and the quantity & amount is been got from the request ( so the value is available for sure ). Can I use various names or should I be using only "options"? Kindly help