handle as server event if user-agent missing
This commit is contained in:
@@ -97,7 +97,7 @@ export async function postEvent(
|
||||
ua,
|
||||
});
|
||||
|
||||
const isServerEvent = !ip && !origin && !isUserAgentSet(ua);
|
||||
const isServerEvent = isUserAgentSet(ua);
|
||||
|
||||
if (isServerEvent) {
|
||||
const [event] = await withTiming(
|
||||
@@ -107,9 +107,7 @@ export async function postEvent(
|
||||
),
|
||||
);
|
||||
|
||||
eventsQueue.add("event", {
|
||||
type: "createEvent",
|
||||
payload: {
|
||||
const payload: Omit<IServiceCreateEventPayload, "id"> = {
|
||||
name: body.name,
|
||||
deviceId: event?.deviceId || "",
|
||||
sessionId: event?.sessionId || "",
|
||||
@@ -142,7 +140,25 @@ export async function postEvent(
|
||||
referrerType: event?.referrerType ?? "",
|
||||
profile: undefined,
|
||||
meta: undefined,
|
||||
},
|
||||
}
|
||||
|
||||
contextLogger.send("server event is queued", {
|
||||
ip,
|
||||
origin,
|
||||
ua,
|
||||
uaInfo,
|
||||
referrer,
|
||||
profileId,
|
||||
projectId,
|
||||
deviceId,
|
||||
path,
|
||||
payload,
|
||||
prevEvent: event,
|
||||
});
|
||||
|
||||
eventsQueue.add("event", {
|
||||
type: "createEvent",
|
||||
payload,
|
||||
});
|
||||
return reply.status(200).send("");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user