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

Region Filter not working #2648

Closed
AkashRajpurohit opened this issue Apr 5, 2024 · 5 comments
Closed

Region Filter not working #2648

AkashRajpurohit opened this issue Apr 5, 2024 · 5 comments
Labels
bug Something isn't working fixed in dev Fixed in the dev branch

Comments

@AkashRajpurohit
Copy link
Contributor

Describe the Bug

On v2.11.0, the region filter throws 500 error. The new migration seems to have run fine.

Database

PostgreSQL

Relevant log output

umami_postgres  | 2024-04-05T10:54:28.222008784Z
umami_postgres  | 2024-04-05T10:54:28.222075914Z PostgreSQL Database directory appears to contain a database; Skipping initialization
umami_postgres  | 2024-04-05T10:54:28.222080729Z
umami_postgres  | 2024-04-05T10:54:28.259394420Z 2024-04-05 10:54:28.259 UTC [1] LOG:  starting PostgreSQL 15.6 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
umami_postgres  | 2024-04-05T10:54:28.259638664Z 2024-04-05 10:54:28.259 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
umami_postgres  | 2024-04-05T10:54:28.259660108Z 2024-04-05 10:54:28.259 UTC [1] LOG:  listening on IPv6 address "::", port 5432
umami_postgres  | 2024-04-05T10:54:28.270180193Z 2024-04-05 10:54:28.270 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
umami_postgres  | 2024-04-05T10:54:28.285749781Z 2024-04-05 10:54:28.284 UTC [24] LOG:  database system was shut down at 2024-04-05 10:54:26 UTC
umami_postgres  | 2024-04-05T10:54:28.295568579Z 2024-04-05 10:54:28.294 UTC [1] LOG:  database system is ready to accept connections
umami_postgres  | 2024-04-05T10:59:28.097195426Z 2024-04-05 10:59:28.097 UTC [22] LOG:  checkpoint starting: time
umami_postgres  | 2024-04-05T11:03:58.144729398Z 2024-04-05 11:03:58.144 UTC [22] LOG:  checkpoint complete: wrote 6747 buffers (41.2%); 0 WAL file(s) added, 0 removed, 21 recycled; write=269.892 s, sync=0.014 s, total=270.048 s; sync files=68, longest=0.014 s, average=0.001 s; distance=336963 kB, estimate=336963 kB
umami_postgres  | 2024-04-05T11:04:16.082560623Z 2024-04-05 11:04:16.082 UTC [169] ERROR:  column "subdivision1" does not exist at character 20
umami_postgres  | 2024-04-05T11:04:16.082615039Z 2024-04-05 11:04:16.082 UTC [169] STATEMENT:
umami_postgres  | 2024-04-05T11:04:16.082622019Z 	    select
umami_postgres  | 2024-04-05T11:04:16.082626667Z 	      subdivision1 x,
umami_postgres  | 2024-04-05T11:04:16.082630351Z 	      count(distinct website_event.session_id) y
umami_postgres  | 2024-04-05T11:04:16.082634424Z 	      , country
umami_postgres  | 2024-04-05T11:04:16.082637813Z 	    from website_event
umami_postgres  | 2024-04-05T11:04:16.082641516Z
umami_postgres  | 2024-04-05T11:04:16.082645071Z 	    where website_event.website_id = $1::uuid
umami_postgres  | 2024-04-05T11:04:16.082648903Z 	      and website_event.created_at between $2 and $3
umami           | 2024-04-05T10:54:34.427263928Z yarn run v1.22.19
umami           | 2024-04-05T10:54:34.490442104Z $ npm-run-all check-db update-tracker start-server
umami           | 2024-04-05T10:54:35.122835015Z $ node scripts/check-db.js
umami           | 2024-04-05T10:54:35.265447536Z ✓ DATABASE_URL is defined.
umami           | 2024-04-05T10:54:35.344337060Z ✓ Database connection successful.
umami           | 2024-04-05T10:54:35.408867344Z ✓ Database version check successful.
umami           | 2024-04-05T10:55:43.533678108Z Prisma schema loaded from prisma/schema.prisma
umami           | 2024-04-05T10:55:43.533941185Z Datasource "db": PostgreSQL database "umami", schema "public" at "umami_db:5432"
umami           | 2024-04-05T10:55:43.534098502Z
umami           | 2024-04-05T10:55:43.534165854Z 5 migrations found in prisma/migrations
umami           | 2024-04-05T10:55:43.534220448Z
umami           | 2024-04-05T10:55:43.534237540Z Applying migration `05_add_visit_id`
umami           | 2024-04-05T10:55:43.534245744Z
umami           | 2024-04-05T10:55:43.534251541Z The following migration(s) have been applied:
umami           | 2024-04-05T10:55:43.534257596Z
umami           | 2024-04-05T10:55:43.534263041Z migrations/
umami           | 2024-04-05T10:55:43.534269022Z   └─ 05_add_visit_id/
umami           | 2024-04-05T10:55:43.534276078Z     └─ migration.sql
umami           | 2024-04-05T10:55:43.534281504Z
umami           | 2024-04-05T10:55:43.534464710Z All migrations have been successfully applied.
umami           | 2024-04-05T10:55:43.534521396Z
umami           | 2024-04-05T10:55:43.534606378Z ✓ Database is up to date.
umami           | 2024-04-05T10:55:43.861411790Z $ node scripts/update-tracker.js
umami           | 2024-04-05T10:55:43.930336939Z Updated tracker endpoint: /api/kentaro.
umami           | 2024-04-05T10:55:44.220954951Z $ node server.js
umami           | 2024-04-05T10:55:44.589829479Z    ▲ Next.js 14.1.4
umami           | 2024-04-05T10:55:44.589953999Z    - Local:        http://localhost:3000
umami           | 2024-04-05T10:55:44.590150279Z    - Network:      http://0.0.0.0:3000
umami           | 2024-04-05T10:55:44.590177557Z
umami           | 2024-04-05T10:55:44.697660653Z  ✓ Ready in 115ms
umami           | 2024-04-05T11:04:16.088080995Z PrismaClientKnownRequestError:
umami           | 2024-04-05T11:04:16.088125172Z Invalid `prisma.$queryRawUnsafe()` invocation:
umami           | 2024-04-05T11:04:16.088133022Z
umami           | 2024-04-05T11:04:16.088137633Z
umami           | 2024-04-05T11:04:16.088142076Z Raw query failed. Code: `42703`. Message: `column "subdivision1" does not exist`
umami           | 2024-04-05T11:04:16.088151760Z     at In.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6854)
umami           | 2024-04-05T11:04:16.088156499Z     at In.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6188)
umami           | 2024-04-05T11:04:16.088160813Z     at In.request (/app/node_modules/@prisma/client/runtime/library.js:122:5896)
umami           | 2024-04-05T11:04:16.088165609Z     at async l (/app/node_modules/@prisma/client/runtime/library.js:127:10871)
umami           | 2024-04-05T11:04:16.088169386Z     at async m (/app/.next/server/pages/api/websites/[websiteId]/metrics.js:1:2976)
umami           | 2024-04-05T11:04:16.088180717Z     at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16545)
umami           | 2024-04-05T11:04:16.088184642Z     at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16981)
umami           | 2024-04-05T11:04:16.088187994Z     at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:554:9)
umami           | 2024-04-05T11:04:16.088191437Z     at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/next/dist/server/next-server.js:266:37)
umami           | 2024-04-05T11:04:16.088194992Z     at async NextNodeServer.handleRequestImpl (/app/node_modules/next/dist/server/base-server.js:791:17) {
umami           | 2024-04-05T11:04:16.088199140Z   code: 'P2010',
umami           | 2024-04-05T11:04:16.088201917Z   clientVersion: '5.11.0',
umami           | 2024-04-05T11:04:16.088205101Z   meta: { code: '42703', message: 'column "subdivision1" does not exist' }
umami           | 2024-04-05T11:04:16.088208212Z }
umami           | 2024-04-05T11:04:19.302044246Z PrismaClientKnownRequestError:
umami           | 2024-04-05T11:04:19.302110752Z Invalid `prisma.$queryRawUnsafe()` invocation:
umami           | 2024-04-05T11:04:19.302120639Z
umami           | 2024-04-05T11:04:19.302124898Z
umami           | 2024-04-05T11:04:19.302128767Z Raw query failed. Code: `42703`. Message: `column "subdivision1" does not exist`
umami           | 2024-04-05T11:04:19.302133063Z     at In.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6854)
umami           | 2024-04-05T11:04:19.302137525Z     at In.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6188)
umami           | 2024-04-05T11:04:19.302142506Z     at In.request (/app/node_modules/@prisma/client/runtime/library.js:122:5896)
umami_postgres  | 2024-04-05T11:04:16.082652458Z 	      and website_event.event_type = $4
umami_postgres  | 2024-04-05T11:04:16.082709984Z
umami_postgres  | 2024-04-05T11:04:16.082718260Z 	    group by 1
umami_postgres  | 2024-04-05T11:04:16.082722352Z 	    , 3
umami_postgres  | 2024-04-05T11:04:16.082725907Z 	    order by 2 desc
umami_postgres  | 2024-04-05T11:04:16.082729295Z 	    limit 500
umami_postgres  | 2024-04-05T11:04:16.082733017Z 	    offset 0
umami_postgres  | 2024-04-05T11:04:16.082764715Z
umami_postgres  | 2024-04-05T11:04:19.300560245Z 2024-04-05 11:04:19.300 UTC [169] ERROR:  column "subdivision1" does not exist at character 20
umami_postgres  | 2024-04-05T11:04:19.300613532Z 2024-04-05 11:04:19.300 UTC [169] STATEMENT:
umami_postgres  | 2024-04-05T11:04:19.300619271Z 	    select
umami_postgres  | 2024-04-05T11:04:19.300623548Z 	      subdivision1 x,
umami_postgres  | 2024-04-05T11:04:19.300634602Z 	      count(distinct website_event.session_id) y
umami_postgres  | 2024-04-05T11:04:19.300638027Z 	      , country
umami_postgres  | 2024-04-05T11:04:19.300641045Z 	    from website_event
umami           | 2024-04-05T11:04:19.302146783Z     at async l (/app/node_modules/@prisma/client/runtime/library.js:127:10871)
umami           | 2024-04-05T11:04:19.302151411Z     at async m (/app/.next/server/pages/api/websites/[websiteId]/metrics.js:1:2976)
umami           | 2024-04-05T11:04:19.302155670Z     at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16545)
umami_postgres  | 2024-04-05T11:04:19.300644193Z
umami_postgres  | 2024-04-05T11:04:19.300646859Z 	    where website_event.website_id = $1::uuid
umami_postgres  | 2024-04-05T11:04:19.300652543Z 	      and website_event.created_at between $2 and $3
umami_postgres  | 2024-04-05T11:04:19.300656857Z 	      and website_event.event_type = $4
umami_postgres  | 2024-04-05T11:04:19.300660153Z
umami_postgres  | 2024-04-05T11:04:19.300662708Z 	    group by 1
umami_postgres  | 2024-04-05T11:04:19.300665911Z 	    , 3
umami_postgres  | 2024-04-05T11:04:19.300669910Z 	    order by 2 desc
umami_postgres  | 2024-04-05T11:04:19.300672835Z 	    limit 500
umami_postgres  | 2024-04-05T11:04:19.300675816Z 	    offset 0
umami           | 2024-04-05T11:04:19.302160076Z     at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16981)
umami           | 2024-04-05T11:04:19.302164576Z     at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:554:9)
umami           | 2024-04-05T11:04:19.302168816Z     at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/next/dist/server/next-server.js:266:37)
umami           | 2024-04-05T11:04:19.302173111Z     at async NextNodeServer.handleRequestImpl (/app/node_modules/next/dist/server/base-server.js:791:17) {
umami           | 2024-04-05T11:04:19.302177147Z   code: 'P2010',
umami           | 2024-04-05T11:04:19.302181128Z   clientVersion: '5.11.0',
umami           | 2024-04-05T11:04:19.302184924Z   meta: { code: '42703', message: 'column "subdivision1" does not exist' }
umami           | 2024-04-05T11:04:19.302189164Z }

Which Umami version are you using? (if relevant)

2.11.0

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Docker

@franciscao633
Copy link
Collaborator

Can you confirm your session table no longer has the subdivision1 column? I have no idea how it would not be there, since the database is initialized with that column.

@AkashRajpurohit
Copy link
Contributor Author

This is the schema for the session table

umami=# \d+ session
                                                           Table "public.session"
    Column    |            Type             | Collation | Nullable |      Default      | Storage  | Compression | Stats target | Description
--------------+-----------------------------+-----------+----------+-------------------+----------+-------------+--------------+-------------
 session_id   | uuid                        |           | not null |                   | plain    |             |              |
 website_id   | uuid                        |           | not null |                   | plain    |             |              |
 hostname     | character varying(100)      |           |          |                   | extended |             |              |
 browser      | character varying(20)       |           |          |                   | extended |             |              |
 os           | character varying(20)       |           |          |                   | extended |             |              |
 device       | character varying(20)       |           |          |                   | extended |             |              |
 screen       | character varying(11)       |           |          |                   | extended |             |              |
 language     | character varying(35)       |           |          |                   | extended |             |              |
 country      | character(2)                |           |          |                   | extended |             |              |
 subdivision1 | character varying(20)       |           |          |                   | extended |             |              |
 subdivision2 | character varying(50)       |           |          |                   | extended |             |              |
 city         | character varying(50)       |           |          |                   | extended |             |              |
 created_at   | timestamp(6) with time zone |           |          | CURRENT_TIMESTAMP | plain    |             |              |
Indexes:
    "session_pkey" PRIMARY KEY, btree (session_id)
    "session_created_at_idx" btree (created_at)
    "session_session_id_key" UNIQUE, btree (session_id)
    "session_website_id_created_at_browser_idx" btree (website_id, created_at, browser)
    "session_website_id_created_at_city_idx" btree (website_id, created_at, city)
    "session_website_id_created_at_country_idx" btree (website_id, created_at, country)
    "session_website_id_created_at_device_idx" btree (website_id, created_at, device)
    "session_website_id_created_at_hostname_idx" btree (website_id, created_at, hostname)
    "session_website_id_created_at_idx" btree (website_id, created_at)
    "session_website_id_created_at_language_idx" btree (website_id, created_at, language)
    "session_website_id_created_at_os_idx" btree (website_id, created_at, os)
    "session_website_id_created_at_screen_idx" btree (website_id, created_at, screen)
    "session_website_id_created_at_subdivision1_idx" btree (website_id, created_at, subdivision1)
    "session_website_id_idx" btree (website_id)
Access method: heap

is something wrong with it? I did not see any errors while upgrading from 2.10.2 and 2.11.0 but started noticing these errors specifically after 2.11.0

@oliverzgy
Copy link

oliverzgy commented Apr 8, 2024

Same issue observed @v2.11.0

@dick86114
Copy link

我也遇到了同样的问题,2.11.0

@franciscao633
Copy link
Collaborator

Confirmed. The query is not joining to the session table. We will get this hot fixed. Thanks for reporting.

@franciscao633 franciscao633 added the bug Something isn't working label Apr 8, 2024
mikecao added a commit that referenced this issue Apr 10, 2024
@mikecao mikecao added the fixed in dev Fixed in the dev branch label Apr 10, 2024
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

5 participants