diff --git a/apps/worker/src/jobs/events.incoming-event.ts b/apps/worker/src/jobs/events.incoming-event.ts index 80e15641..88822761 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) { }; // 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 5f05c117..326fad5a 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 );