When using await on superagent we should not call end()
https://visionmedia.github.io/superagent/#promise-and-generator-support
This commit is contained in:
@@ -570,7 +570,7 @@ async function notifyLoginLocation(user, ip, userAgent, auditSource) {
|
||||
|
||||
if (constants.TEST && ip === '127.0.0.1') return;
|
||||
|
||||
const response = await superagent.get('https://geolocation.cloudron.io/json').query({ ip }).ok(() => true).end();
|
||||
const response = await superagent.get('https://geolocation.cloudron.io/json').query({ ip }).ok(() => true);
|
||||
if (response.statusCode !== 200) return console.error(`Failed to get geoip info. statusCode: ${response.statusCode}`);
|
||||
|
||||
const country = safe.query(response.body, 'country.names.en', '');
|
||||
|
||||
Reference in New Issue
Block a user