umami-software / umami

Umami is a simple, fast, privacy-focused alternative to Google Analytics.
https://umami.is
MIT License
21.96k stars 4.09k forks source link

Internal Server Error when resetting website #2915

Open ov3rk1ll opened 2 weeks ago

ov3rk1ll commented 2 weeks ago

Describe the Bug

I'm running the latest version in a docker environment.

When I try to reset a website, I only get a "Internal Server Error" on the page image

as well as a prisma error on the container log

Database

PostgreSQL

Relevant log output

Invalid `prisma.session.deleteMany()` invocation:
The change you are trying to make would violate the required relation 'SessionToSessionData' between the `SessionData` and `Session` models.
    at _n.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:121:7749)
    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) {
  code: 'P2014',
  clientVersion: '5.17.0',
{
    modelName: 'Session',
    relation_name: 'SessionToSessionData',
    model_a_name: 'SessionData',
    model_b_name: 'Session'
  }
}

Which Umami version are you using? (if relevant)

v2.13.1

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

franciscao633 commented 2 weeks ago

Forgot to add the cascading delete to prisma for session_data. If you need to reset the website in the meantime just delete all the data in that table for that specific website, then the reset should work.

ThorANilsson commented 2 weeks ago

Forgot to add the cascading delete to prisma for session_data. If you need to reset the website in the meantime just delete all the data in that table for that specific website, then the reset should work.

This solution works.