1

I have a Node JS api running on server. API is being used in angular application to load dropdown values. Sometime I have observed that empty dropdown render in browser.

I checked logs of API. It has below details.

problem updating cache in get. { Error: connect ETIMEDOUT <IP address>:<port> at TCPConnectWrap.afterConnect [as oncomplete] (net.js:), errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect',

API is using node-mssql libaray to connect fetch records from database.

From error I am not able to figure out where exactly problem is.

API Route:

router.get('/get-cities/:statecd', function (req, res, next) {
   businessController.getCities(req,res,next);
});

businessController:

getCities: function (req, res, next) {
       
            var params= [];
            params.push(new Parameter('StateCd', sql.Int, req.params.statecd));
            dbController.execProc('<procname>', params, function (err, data) {
                if (err) {
                    next(err);
                } else {
                    res.send(data);
                }
            })        
    }

DB Controller

module.exports.execProc = async function (prcNm, params, callback) {
    
    let con;
    let result;

    try {
        con= await getConnection();
    } catch (err) {
        callback(err);
    }

    try {
        request = new sql.Request(con);
        if (parameterList) {
            for (const param of parameterList) {
                request.input(param.Nm, param.Ty, param.Val);
            }
        }

        result = await request.execute(prcNm);
        callback(result);
    } catch (err) {
        callback(err);
    }
}
Anil
  • 1,669
  • 5
  • 19
  • 44

0 Answers0