Stephen Peppers
Stephen Peppers

Reputation: 1

Azure node increasing connection timeout

I have a mobile app backend built with azure/node and I can't seem to figure out how to increase my SQL database connection timeout. It looks like the default is 15 seconds and I would like to increase it to 30. Specifically the code that is connecting to the DB is below (using azure-mobile-apps node package). Thanks!

var azureMobileApps = require('azure-mobile-apps');

var app = express();
var mobileApp = azureMobileApps({
    homePage: true,
    swagger: true
});

mobileApp.tables.import('./tables');
mobileApp.api.import('./api');

//This times out after 15 seconds and I want to change it to 30.
mobileApp.tables.initialize()
    .then(function () {
        app.use(mobileApp);
        app.listen(process.env.PORT || 3000);
    });

Upvotes: 0

Views: 952

Answers (2)

Aaron Chen
Aaron Chen

Reputation: 9940

You need to alter the connection string by adding ;Connection Timeout=30 to it in the Azure portal. The default 15 and it is in seconds.

enter image description here

Upvotes: 1

Alberto Morillo
Alberto Morillo

Reputation: 15648

To increase the timeout for the request you could try to put this to your app.js file.

var mobileApp = azureMobileApps({
    homePage: true,
    data: {
        requestTimeout: 60000
    }
});

Upvotes: 1

Related Questions