Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

minor worker fix

Carl-Gerhard Lindesvärd6934959d5b84
diff --git a/apps/worker/src/jobs/events.incoming-event.ts b/apps/worker/src/jobs/events.incoming-event.ts
index 80e15641e..88822761c 100644
--- a/apps/worker/src/jobs/events.incoming-event.ts
+++ b/apps/worker/src/jobs/events.incoming-event.ts
@@ -47,10 +47,7 @@ export async function incomingEvent(job: Job<EventsQueuePayloadIncomingEvent>) {
};
// this will get the profileId from the alias table if it exists
- const profileId = await getProfileIdCached({
- profileId: body.profileId,
- projectId,
- });
+ const profileId = body.profileId ?? '';
const createdAt = new Date(body.timestamp);
const url = getProperty('__path');
const { path, hash, query, origin } = parsePath(url);
diff --git a/packages/db/src/services/event.service.ts b/packages/db/src/services/event.service.ts
index 5f05c117f..326fad5a0 100644
--- a/packages/db/src/services/event.service.ts
+++ b/packages/db/src/services/event.service.ts
@@ -459,6 +459,10 @@ export async function getLastScreenViewFromProfileId({
profileId: string;
projectId: string;
}) {
+ if (!profileId) {
+ return null;
+ }
+
const eventInBuffer = await eventBuffer.find(
(item) => item.event.profile_id === profileId
);