Rule to notify slack channel if context.request.ip = a list of IPs causing Request to Webtask got ESOCKETTIMEDOUT

Hi, I hacked together a few existing rules, “Email domain whitelist” and “Slack Notification on User Signup” to create a rule “IP Address blacklist”.

The rule checks the context.request.ip against a list of known bad IP addresses, and notifies a slack channel if there is a match.

If the user’s context.request.ip is on the list, login and signup works great. For everyone else, login and signup doesn’t work consistently and takes forever. Usually we see “Failed Silent Auth” +
“Request to Webtask got ESOCKETTIMEDOUT” errors.

Can the rule be written asynchronously so it doesn’t interfere with the login, but still notifies the slack channel?

Setting up the IP address list as a configuration doesn’t help vs. writing out the IP addresses. The string might be too long for a configuration? We have the SLACK_HOOK_URL setup as a configuration, that works fine.

Here is the code (with redactions):

function (user, context, callback) {
const blacklist = [‘IP…ADDRESS.1’,‘IP…ADDRESS.2’,‘IP.ADDRESS.102’]; // unauthorized IPs
const blacklistuser = blacklist.some(function (ip) {
return context.request.ip === ip;

if (!blacklistuser) return;
// get your slack’s hook url from:
const SLACK_HOOK = configuration.SLACK_HOOK_URL;

const slack = require(‘slack-notify’)(SLACK_HOOK);
const message = ‘Login from fraudulent IP: ’ + ( || + ’ (’ + + ‘)’ + ’ (’ + context.request.ip + ‘)’;
const channel = ‘#fraud_alerts’;

text: message,
channel: channel

// don’t wait for the Slack API call to finish, return right away (the request will continue on the sandbox)`
callback(null, user, context);