understand why bot events not working
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { isBot } from '@/bots';
|
import { isBot } from '@/bots';
|
||||||
|
import { logInfo } from '@/utils/logger';
|
||||||
import { getClientIp, parseIp } from '@/utils/parseIp';
|
import { getClientIp, parseIp } from '@/utils/parseIp';
|
||||||
import { getReferrerWithQuery, parseReferrer } from '@/utils/parseReferrer';
|
import { getReferrerWithQuery, parseReferrer } from '@/utils/parseReferrer';
|
||||||
import { isUserAgentSet, parseUserAgent } from '@/utils/parseUserAgent';
|
import { isUserAgentSet, parseUserAgent } from '@/utils/parseUserAgent';
|
||||||
@@ -156,11 +157,16 @@ export async function postEvent(
|
|||||||
|
|
||||||
const bot = isBot(ua);
|
const bot = isBot(ua);
|
||||||
if (bot) {
|
if (bot) {
|
||||||
|
request.log.info({ bot, ua }, 'bot detected 2');
|
||||||
|
try {
|
||||||
await createBotEvent({
|
await createBotEvent({
|
||||||
...bot,
|
...bot,
|
||||||
projectId,
|
projectId,
|
||||||
createdAt: new Date(body.timestamp),
|
createdAt: new Date(body.timestamp),
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
request.log.error(e, 'bot detected 2 failed');
|
||||||
|
}
|
||||||
return reply.status(200).send('');
|
return reply.status(200).send('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user