2

Hi I am trying to use axios on server side (node js) and calling post request. Below is my code. It works fine when I am using postman but it gives 503 ( service unavailable ) when hitting from node js. Is there any thing I am doing wrong here ?

    try {
        const sendInvitePayload = {
            UID: "132465789",
            invitees: [
                "9200000000"
            ],
            customerType: "consumer"
        }

        const sendInviteOptions = {
            method: 'post',
            url: "http://xxxxxxx,
            headers: headers,
            data: sendInvitePayload
        };

        logger.info({
            event: 'send invite request to non jazz cash user options',
            functionName: 'sendMoneyService.confirmNonJcPaymentC2C',
            data: sendInviteOptions,
        });

        const inviteResponse = await axios(sendInviteOptions);
        console.log(inviteResponse)
    } catch (error) {

        logger.error({
            event: 'Failure : Exited function',
            functionName: 'sendMoneyService.confirmNonJcPaymentC2C',
            error: { message: error.message, stack: error.stack },
        });

        return false;

    }
Usman Iqbal
  • 2,379
  • 5
  • 26
  • 50

0 Answers0