Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument websiteId is missing. #2614

Closed
oliverzgy opened this issue Mar 17, 2024 · 12 comments
Closed

Argument websiteId is missing. #2614

oliverzgy opened this issue Mar 17, 2024 · 12 comments
Labels
bug Something isn't working fixed in dev Fixed in the dev branch

Comments

@oliverzgy
Copy link

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

@franciscao633
Copy link
Collaborator

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?

@obstkompost
Copy link

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

@CTHRU
Copy link

CTHRU commented Apr 24, 2024

[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.

@genki
Copy link

genki commented Apr 29, 2024

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.

@ndaidong
Copy link

ndaidong commented May 16, 2024

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

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

@mikecao mikecao added bug Something isn't working fixed in dev Fixed in the dev branch labels Jun 21, 2024
@mikecao
Copy link
Collaborator

mikecao commented Jun 21, 2024

Fixed in v2.12.0.

@mikecao mikecao closed this as completed Jun 21, 2024
@toyo2333
Copy link

toyo2333 commented Aug 1, 2024

  • 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'
}

@kddial
Copy link

kddial commented Aug 15, 2024

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?

@ldpr
Copy link

ldpr commented Sep 1, 2024

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?

@jjjhill
Copy link

jjjhill commented Sep 4, 2024

+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
Copy link

jjjhill commented Sep 5, 2024

found a fix. not sure if it's robust. Here's a PR: #2946

@jjjhill
Copy link

jjjhill commented Sep 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in dev Fixed in the dev branch
Projects
None yet
Development

No branches or pull requests