Custom database error "connect ECONNREFUSED"

Problem statement

We are trying to set up a Custom Database connection and believe we have created the login script correctly. But, when testing the login, we see the "connect ECONNREFUSED" error on the login page.


  • Custom Database Login script:
function login(email, password, callback) {
  const request = require('request');

    url: 'https://localhost/profile';,
    auth: {
      username: email,
      password: password
  }, function(err, response, body) {
    if (err) return callback(err);
    if (response.statusCode === 401) return callback();
    const user = JSON.parse(body);

    callback(null, {
      user_id: user.user_id.toString(),
      nickname: user.nickname,


  • The script is attempting to request ‘https://localhost/profile’;. However, database action scripts run on Webtask containers that do not have access to a server running locally on your machine.


We recommend making the database accessible on a public URL and changing the localhost URL to a publicly accessible URL.