umami icon indicating copy to clipboard operation
umami copied to clipboard

Argument `websiteId` is missing.

Open oliverzgy opened this issue 11 months ago • 5 comments

Describe the Bug

Found in the console

Database

PostgreSQL

Relevant log output

umami-1  | PrismaClientValidationError: 
umami-1  | Invalid `prisma.websiteEvent.create()` invocation:
umami-1  | 
umami-1  | {
umami-1  |   data: {
umami-1  |     id: "9051123e-d9bc-40f3-aaf5-c15a2199b833",
umami-1  |     sessionId: undefined,
umami-1  |     urlPath: "/home",
umami-1  |     urlQuery: undefined,
umami-1  |     referrerPath: "/",
umami-1  |     referrerQuery: undefined,
umami-1  |     referrerDomain: undefined,
umami-1  |     pageTitle: "------------",
umami-1  |     eventType: 1,
umami-1  |     eventName: null,
umami-1  | +   websiteId: String
umami-1  |   }
umami-1  | }
umami-1  | 
umami-1  | Argument `websiteId` is missing.
umami-1  |     at ri (/app/node_modules/@prisma/client/runtime/library.js:119:5888)
umami-1  |     at ai.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:126:6431)
umami-1  |     at ai.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:126:6109)
umami-1  |     at ai.request (/app/node_modules/@prisma/client/runtime/library.js:126:5817)
umami-1  |     at async l (/app/node_modules/@prisma/client/runtime/library.js:131:9709)
umami-1  |     at async h (/app/.next/server/pages/api/send.js:1:2849)
umami-1  |     at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16545)
umami-1  |     at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16981)
umami-1  |     at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:556:9)
umami-1  |     at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/next/dist/server/next-server.js:268:37) {
umami-1  |   clientVersion: '5.9.1'
umami-1  | }

Which Umami version are you using? (if relevant)

2.10.2

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Docker

oliverzgy avatar Mar 17 '24 09:03 oliverzgy

Both sessionId and websiteId are non-nullable columns, so it should fail. Just wondering how it got to this state. This was produced from the tracker and not a custom payload?

franciscao633 avatar Mar 18 '24 20:03 franciscao633

Found the Same Error in the Logs of a self-hosted umami:

PrismaClientValidationError: Invalid prisma.websiteEvent.create() invocation: { data: { id: "XXXXXXXXXXXXXXXXXXXXXXX", sessionId: undefined, visitId: "XXXXXXXXXXXXXXXXXXXXXXXX", urlPath: "#/XXXXXXXXXXXX", urlQuery: undefined, referrerPath: "#/", referrerQuery: undefined, referrerDomain: "", pageTitle: "XXXXXXXXXXXXXXX", eventType: 1, eventName: null,

  • websiteId: String } } Argument websiteId is missing. at Tn (/app/node_modules/@prisma/client/runtime/library.js:115:5888) at In.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6510)

Client Version:5.11.0

obstkompost avatar Apr 06 '24 13:04 obstkompost

[EDIT] The custom script was definitely a cause, but the error still pops up from time to time. If anyone has more info on this issue, I'm interested.

Fwiw, I had the same issue but the cause was outside Umami. Maybe the info can be of help to others too.

I had a custom script that called umami.track but I forgot to wait for the umami-script to be loaded.

  <script data-id="umami-script" defer src="..." data-website-id="..."></script>

<script type="text/javascript">
    function myTracker(eventName, eventData) {
    ...
    umami.track(eventName, eventData);
    }
</script>

This randomly failed with the above mentioned error, due to the umami script not being loaded yet when myTracker was called. The solution was to add a listener for the umami-script to be loaded, like so:

<script data-id="umami-script" defer src="..." data-website-id="..."></script>

<script type="text/javascript">
    function myTracker(eventName, eventData) {
       document.querySelector('script[data-id="umami-script"]').addEventListener('load', function () {
          ...
          umami.track(eventName, eventData);
       });
    }
</script>

[EDIT 2] In my case, if my web app would call the myTracker() function before the script was loaded, this would cause the event not to be generated. I removed the defer option from the umami-script line to make sure it loads before the app starts, delays are negligable. So now I have:

<script data-id="umami-script" src="..." data-website-id="..."></script>

<script type="text/javascript">
    function myTracker(eventName, eventData) {
          ...
          umami.track(eventName, eventData);
    }
</script>

which seems to work fine. I'll report back if it wouldn't solve my issue.

CTHRU avatar Apr 24 '24 09:04 CTHRU

I also have the same issue today.

 Invalid `prisma.websiteEvent.create()` invocation:
   |
   | {
   |   data: {
   |     id: "********",
   |     sessionId: undefined,
   |     visitId: "*******",
   |     urlPath: "/",
   |     urlQuery: undefined,
   |     referrerPath: undefined,
   |     referrerQuery: undefined,
   |     referrerDomain: "",
   |     pageTitle: "******",
   |     eventType: 1,
   |     eventName: null,
   | +   websiteId: String
   |   }
   | }
   |
   | Argument `websiteId` is missing.
   |     at Tn (/app/node_modules/@prisma/client/runtime

I am using v2.11.2 at my own host.

genki avatar Apr 29 '24 21:04 genki

I got the same error. Umami v2.11.3, Postgres 16.2, docker container

Screenshot from 2024-05-16 20-51-33

ndaidong avatar May 16 '24 13:05 ndaidong

Fixed in v2.12.0.

mikecao avatar Jun 21 '24 03:06 mikecao

  • v 2.12.1
  • docker compose
Argument `websiteId` is missing.
    at Tn (/app/node_modules/@prisma/client/runtime/library.js:115:6855)
    at In.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6533)
    at In.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6211)
    at In.request (/app/node_modules/@prisma/client/runtime/library.js:122:5919)
    at async l (/app/node_modules/@prisma/client/runtime/library.js:127:11167)
    at async h (/app/.next/server/pages/api/send.js:1:3068)
    at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16853)
    at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17492)
    at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:600:9)
    at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/next/dist/server/next-server.js:269:37) {
  clientVersion: '5.14.0'
}

toyo2333 avatar Aug 01 '24 08:08 toyo2333

I also still get this issue in our server logs on version v2.12.1.

Database: MySQL

Log output (I redacted information with asterisks *):

Argument `websiteId` is missing.
at Tn (/app/node_modules/@prisma/client/runtime/library.js:115:6855)
at In.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6533)
at In.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6211)
at In.request (/app/node_modules/@prisma/client/runtime/library.js:122:5919)
at async l (/app/node_modules/@prisma/client/runtime/library.js:127:11167)
at async h (/app/.next/server/pages/api/send.js:1:3068)
at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16853)
at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17492)
at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:600:9)
at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/next/dist/server/next-server.js:269:37) {
  clientVersion: '5.14.0'
}

PrismaClientValidationError:
Invalid `prisma.websiteEvent.create()` invocation:
{
data: {
  id: "81720f84-71f1-4863-b927-07b3e1fbf0e9",
  sessionId: undefined,
  visitId: "0519dbca-d94f-5a53-bfa4-66a53fdfe916",
  urlPath: "/****/*****/**********************/**********",
  urlQuery: "*****=****&****=*",
  referrerPath: "/****/*****/**********************/**********",
  referrerQuery: undefined,
  referrerDomain: "",
  pageTitle: "***** ****** ***** **** **** ***** | ******* ********",
  eventType: 1,
  eventName: null,
  + websiteId: String
  }
}

Umami version: v2.12.1

Deployment: docker from umami packages

Tracker script:

<script defer="" src="https://***************.com/script.js" data-website-id="e9c5a45a-ab11-4bd9-bab1-ceaadf94ca70"></script>

Can someone take another look please?

kddial avatar Aug 15 '24 19:08 kddial

i'm seeing this problem in 2.13.2 also

2024-08-31T18:34:20.826110+00:00 analytics npx[814]: Argument `websiteId` is missing.
2024-08-31T18:34:20.826122+00:00 analytics npx[814]:     at An (/opt/umami/node_modules/@prisma/client/runtime/library.js:114:7526)
2024-08-31T18:34:20.826135+00:00 analytics npx[814]:     at _n.handleRequestError (/opt/umami/node_modules/@prisma/client/runtime/library.js:121:7392)
2024-08-31T18:34:20.826147+00:00 analytics npx[814]:     at _n.handleAndLogRequestError (/opt/umami/node_modules/@prisma/client/runtime/library.js:121:7057)
2024-08-31T18:34:20.826160+00:00 analytics npx[814]:     at _n.request (/opt/umami/node_modules/@prisma/client/runtime/library.js:121:6741)
2024-08-31T18:34:20.826173+00:00 analytics npx[814]:     at async l (/opt/umami/node_modules/@prisma/client/runtime/library.js:130:9355)
2024-08-31T18:34:20.826185+00:00 analytics npx[814]:     at async x (/opt/umami/.next/server/pages/api/send.js:1:2791)
2024-08-31T18:34:20.826197+00:00 analytics npx[814]:     at async K (/opt/umami/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16853)
2024-08-31T18:34:20.826210+00:00 analytics npx[814]:     at async U.render (/opt/umami/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17492)
2024-08-31T18:34:20.826223+00:00 analytics npx[814]:     at async NextNodeServer.runApi (/opt/umami/node_modules/next/dist/server/next-server.js:600:9)
2024-08-31T18:34:20.826236+00:00 analytics npx[814]:     at async NextNodeServer.handleCatchallRenderRequest (/opt/umami/node_modules/next/dist/server/next-server.js:269:37) {
2024-08-31T18:34:20.826248+00:00 analytics npx[814]:   clientVersion: '5.17.0'
2024-08-31T18:34:20.826260+00:00 analytics npx[814]: }

database: postgres version: 2.13.2 selfhosted non-docker

@mikecao could this please be re-opened?

ldpr avatar Sep 01 '24 03:09 ldpr

+1 in v2.13.2, self hosted, postgres, with docker. Is there a workaround?

2024-09-04 15:15:45 PrismaClientValidationError: 
2024-09-04 15:15:45 Invalid `prisma.sessionData.create()` invocation:
2024-09-04 15:15:45 
2024-09-04 15:15:45 {
2024-09-04 15:15:45   data: {
2024-09-04 15:15:45     id: "8da2799f-edac-419c-8952-a741be579d37",
2024-09-04 15:15:45     websiteId: undefined,
2024-09-04 15:15:45     sessionId: undefined,
2024-09-04 15:15:45     dataKey: "role",
2024-09-04 15:15:45     stringValue: "cmst_admin",
2024-09-04 15:15:45     numberValue: null,
2024-09-04 15:15:45     dateValue: null,
2024-09-04 15:15:45     dataType: 1,
2024-09-04 15:15:45 +   website: {
2024-09-04 15:15:45 +     create: WebsiteCreateWithoutSessionDataInput | WebsiteUncheckedCreateWithoutSessionDataInput,
2024-09-04 15:15:45 +     connectOrCreate: WebsiteCreateOrConnectWithoutSessionDataInput,
2024-09-04 15:15:45 +     connect: WebsiteWhereUniqueInput
2024-09-04 15:15:45 +   }
2024-09-04 15:15:45   }
2024-09-04 15:15:45 }
2024-09-04 15:15:45 
2024-09-04 15:15:45 Argument `website` is missing.
2024-09-04 15:15:45     at An (/app/node_modules/@prisma/client/runtime/library.js:114:7526)
2024-09-04 15:15:45     at _n.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7392)
2024-09-04 15:15:45     at _n.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7057)
2024-09-04 15:15:45     at _n.request (/app/node_modules/@prisma/client/runtime/library.js:121:6741)
2024-09-04 15:15:45     at async l (/app/node_modules/@prisma/client/runtime/library.js:130:9355)
2024-09-04 15:15:45     at async w (/app/.next/server/chunks/405.js:1132:1075)
2024-09-04 15:15:45     at async x (/app/.next/server/pages/api/send.js:1:3010)
2024-09-04 15:15:45     at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16853)
2024-09-04 15:15:45     at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17492)
2024-09-04 15:15:45     at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:600:9) {
2024-09-04 15:15:45   clientVersion: '5.17.0'
2024-09-04 15:15:45 }
2024-09-04 15:15:45 PrismaClientValidationError: 
2024-09-04 15:15:45 Invalid `prisma.websiteEvent.create()` invocation:
2024-09-04 15:15:45 
2024-09-04 15:15:45 {
2024-09-04 15:15:45   data: {
2024-09-04 15:15:45     id: "dfeeb376-320e-43a0-942d-4b63b3d6cbd1",
2024-09-04 15:15:45     sessionId: undefined,
2024-09-04 15:15:45     visitId: "e6531739-cc48-587e-98e5-33511902633c",
2024-09-04 15:15:45     urlPath: "/mxp/planning/",
2024-09-04 15:15:45     urlQuery: undefined,
2024-09-04 15:15:45     referrerPath: "/mxp/planning/",
2024-09-04 15:15:45     referrerQuery: "",
2024-09-04 15:15:45     referrerDomain: "localhost",
2024-09-04 15:15:45     pageTitle: "MxP App",
2024-09-04 15:15:45     eventType: 1,
2024-09-04 15:15:45     eventName: null,
2024-09-04 15:15:45 +   websiteId: String
2024-09-04 15:15:45   }
2024-09-04 15:15:45 }
2024-09-04 15:15:45 
2024-09-04 15:15:45 Argument `websiteId` is missing.
2024-09-04 15:15:45     at An (/app/node_modules/@prisma/client/runtime/library.js:114:7526)
2024-09-04 15:15:45     at _n.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7392)
2024-09-04 15:15:45     at _n.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7057)
2024-09-04 15:15:45     at _n.request (/app/node_modules/@prisma/client/runtime/library.js:121:6741)
2024-09-04 15:15:45     at async l (/app/node_modules/@prisma/client/runtime/library.js:130:9355)
2024-09-04 15:15:45     at async x (/app/.next/server/pages/api/send.js:1:2791)
2024-09-04 15:15:45     at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16853)
2024-09-04 15:15:45     at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17492)
2024-09-04 15:15:45     at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:600:9)
2024-09-04 15:15:45     at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/next/dist/server/next-server.js:269:37) {
2024-09-04 15:15:45   clientVersion: '5.17.0'
2024-09-04 15:15:45 }

jjjhill avatar Sep 04 '24 19:09 jjjhill

found a fix. not sure if it's robust. Here's a PR: https://github.com/umami-software/umami/pull/2946

jjjhill avatar Sep 05 '24 02:09 jjjhill

For more context, the issue arises on new deployments of umami when there is no entries in the website_event table. Therefore performing an inner join on this table returns no entries, even when there is a matching session in the session table. Performing an outer join will at least allow the current session to be returned from this query when the website_event table is empty.

I haven't tested if this results in miscounted events and views from the sum aggregate, however.

jjjhill avatar Sep 05 '24 03:09 jjjhill

We have a deployment with data in the table, and some users are unfortunately triggering this error still. Still diving into it...

d717an avatar Nov 21 '24 20:11 d717an

Hey everyone!

I'm encountering the same issue with my self hosted instance of Umami (v2.14.0) and Postgres.

If I try to send an identify request and no events has been recorded yet, I get the error that website ID is missing.

The thing is, further requests (regular events) fails too. The app seems to stay in a broken state. I had to clean up the website data and then send regular events to get it to work.

I've got the same exact logs as anyone else but if you need more info, let me know.

Sov3rain avatar Nov 26 '24 09:11 Sov3rain

Me too. Still encountering the sam issue. Sometimes it works well, sometimes it fails.

  • self hosted docker
  • Umami (v2.14.0)
  • Postgres
  • image: docker pull docker.umami.is/umami-software/umami:postgresql-latest

hongkunyoo avatar Nov 28 '24 06:11 hongkunyoo

Update: I'm now getting the error randomly, even when i'm not using the identify feature. My database has some events already. Had to redeploy the server instance to get it to work again.

Sov3rain avatar Nov 28 '24 08:11 Sov3rain

Same error

Argument websiteId is missing. at An (/app/node_modules/@prisma/client/runtime/library.js:114:7526) at _n.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7392) at _n.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7057) at _n.request (/app/node_modules/@prisma/client/runtime/library.js:121:6741) at async l (/app/node_modules/@prisma/client/runtime/library.js:130:9355) at async x (/app/.next/server/pages/api/send.js:1:2791) at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16853) at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17492) at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:600:9) at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/next/dist/server/next-server.js:269:37) { clientVersion: '5.17.0' }

m1911star avatar Dec 06 '24 01:12 m1911star

Same problem. After I reset the website data the error is gone.

Probably something related with session data since I started using that yesterday (umami.identify) and all the sites that are not using it are working fine.

Self-hosted umami-software/umami:mysql-v2.14.0.

diogomartino avatar Dec 09 '24 22:12 diogomartino

Can confirm (v2.14.0, ghcr.io/umami-software/umami:postgresql-v2.14.0), this issue has not been fixed and should be re-opened.

Argument `websiteId` is missing.
    at An (/app/node_modules/@prisma/client/runtime/library.js:114:7526)
    at _n.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7392)
    at _n.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7057)
    at _n.request (/app/node_modules/@prisma/client/runtime/library.js:121:6741)
    at async l (/app/node_modules/@prisma/client/runtime/library.js:130:9355)
    at async x (/app/.next/server/pages/api/send.js:1:2797)
    at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16881)
    at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17520)
    at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:598:9)
    at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/next/dist/server/next-server.js:269:37) {
  clientVersion: '5.17.0'
}

manuel-rw avatar Dec 10 '24 08:12 manuel-rw

@mikecao Can you re-open this issue? Seems like a lot of people are still encountering this problem.

Sov3rain avatar Dec 10 '24 08:12 Sov3rain

Re-opening. Found the issue and will push out a fix.

mikecao avatar Dec 11 '24 23:12 mikecao