When using await on superagent we should not call end()

https://visionmedia.github.io/superagent/#promise-and-generator-support
This commit is contained in:
Johannes Zellner
2021-07-29 11:26:23 +02:00
parent eda3cd83ae
commit 8e42423f06

View File

@@ -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', '');