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