I'm trying to call and get the response from another lambda function using lambda invoke. The problem is other lambda function needs the id to be sent as path parameters (or as a query string). But I do not see an option in lambda invoke for this. If I pass the id in payload the other function will receive it in the event body and not as path parameters. Is there an existing solution for this?
Here is a function inside a lambda function which calls another lambda function which receives the data as query string parameters
function getWisIqLink(data) {
const payload = {
queryStringParameters: {
userId: data.userId,
eventId: data.eventId,
}
};
const param = {
FunctionName: 'consult-rest-api-dev-WisiqClassGet',
InvocationType: "RequestResponse",
Payload: JSON.stringify(payload)
}
return new Promise((resolve, reject) => {
// console.log(`Starting promiseInvoke InvokeAsync with ES6 promise wrapper - ${functionName}`);
lambda.invoke(param,(err, data) => {
if (err) {
reject(err);
} else {
resolve(JSON.parse(data));
}
}
);
});
}
Here is a bit of a lambda function which receives the data as query strings (Not the function which receives data as path parameters)
module.exports.get = async function (event, context, callback) {
const data = {
userId: event.queryStringParameters.userId,
eventId: event.queryStringParameters.eventId,
};