umami icon indicating copy to clipboard operation
umami copied to clipboard

Vercel build: 09_update_hostname_region migration failing

Open monyasau opened this issue 7 months ago • 3 comments

Describe the Bug

Hi, After i tried to upgrade to v2.18.1 from v2.15.1, vercel threw a build error:

A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve

Migration name: 09_update_hostname_region
Database error code: 57014
Database error:
ERROR: canceling statement due to statement timeout
DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E57014), message: "canceling statement due to statement timeout", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("postgres.c"), line: Some(3330), routine: Some("ProcessInterrupts") }

Database

PostgreSQL

Relevant log output

[09:34:43.528] Running build in Washington, D.C., USA (East) – iad1
[09:34:43.529] Build machine configuration: 2 cores, 8 GB
[09:34:43.719] Previous build caches not available
[09:34:44.271] Cloning completed: 730.000ms
[09:34:45.223] Running "vercel build"
[09:34:45.799] Vercel CLI 41.7.3
[09:34:46.346] Detected `pnpm-lock.yaml` 9 which may be generated by [email protected] or [email protected]
[09:34:46.346] Using [email protected] based on project creation date
[09:34:46.347] To use [email protected], manually opt in using corepack (https://vercel.com/docs/deployments/configure-a-build#corepack)
[09:34:46.380] Installing dependencies...
[09:34:47.074] Lockfile is up to date, resolution step is skipped
[09:34:47.188] Progress: resolved 1, reused 0, downloaded 0, added 0
[09:34:47.432] Packages: +1363
[09:34:47.432] ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[09:34:48.189] Progress: resolved 1363, reused 0, downloaded 20, added 20
[09:34:49.190] Progress: resolved 1363, reused 0, downloaded 59, added 43
[09:34:50.190] Progress: resolved 1363, reused 0, downloaded 94, added 79
[09:34:51.191] Progress: resolved 1363, reused 0, downloaded 142, added 131
[09:34:52.191] Progress: resolved 1363, reused 0, downloaded 248, added 235
[09:34:53.439] Progress: resolved 1363, reused 0, downloaded 249, added 235
[09:34:54.440] Progress: resolved 1363, reused 0, downloaded 264, added 248
[09:34:55.440] Progress: resolved 1363, reused 0, downloaded 296, added 282
[09:34:56.443] Progress: resolved 1363, reused 0, downloaded 299, added 284
[09:34:57.443] Progress: resolved 1363, reused 0, downloaded 427, added 420
[09:34:58.445] Progress: resolved 1363, reused 0, downloaded 472, added 457
[09:34:59.445] Progress: resolved 1363, reused 0, downloaded 566, added 561
[09:35:00.446] Progress: resolved 1363, reused 0, downloaded 777, added 772
[09:35:01.446] Progress: resolved 1363, reused 0, downloaded 861, added 846
[09:35:02.447] Progress: resolved 1363, reused 0, downloaded 936, added 920
[09:35:03.447] Progress: resolved 1363, reused 0, downloaded 999, added 986
[09:35:04.449] Progress: resolved 1363, reused 0, downloaded 1061, added 1054
[09:35:05.449] Progress: resolved 1363, reused 0, downloaded 1255, added 1252
[09:35:06.449] Progress: resolved 1363, reused 0, downloaded 1307, added 1294
[09:35:07.451] Progress: resolved 1363, reused 0, downloaded 1353, added 1340
[09:35:07.545] Progress: resolved 1363, reused 0, downloaded 1363, added 1363, done
[09:35:07.968] .../node_modules/@prisma/engines postinstall$ node scripts/postinstall.js
[09:35:07.982] .../[email protected]/node_modules/esbuild postinstall$ node install.js
[09:35:07.982] .../[email protected]/node_modules/cypress postinstall$ node index.js --exec install
[09:35:07.983] .../[email protected]/node_modules/sharp install$ node install/check
[09:35:08.175] .../[email protected]/node_modules/esbuild postinstall: Done
[09:35:08.324] .../[email protected]/node_modules/sharp install: Done
[09:35:08.880] .../[email protected]/node_modules/cypress postinstall: Installing Cypress (version: 13.17.0)
[09:35:08.881] .../[email protected]/node_modules/cypress postinstall: [STARTED] Task without title.
[09:35:09.205] .../node_modules/@prisma/engines postinstall: Done
[09:35:10.659] .../[email protected]/node_modules/cypress postinstall: [SUCCESS] Task without title.
[09:35:10.660] .../[email protected]/node_modules/cypress postinstall: [STARTED] Task without title.
[09:35:16.911] .../[email protected]/node_modules/cypress postinstall: [SUCCESS] Task without title.
[09:35:16.912] .../[email protected]/node_modules/cypress postinstall: [STARTED] Task without title.
[09:35:16.924] .../[email protected]/node_modules/cypress postinstall: [SUCCESS] Task without title.
[09:35:17.926] .../[email protected]/node_modules/cypress postinstall: You can now open Cypress by running one of the following, depending on your package manager:
[09:35:17.926] .../[email protected]/node_modules/cypress postinstall: - npx cypress open
[09:35:17.926] .../[email protected]/node_modules/cypress postinstall: - yarn cypress open
[09:35:17.926] .../[email protected]/node_modules/cypress postinstall: - pnpm cypress open
[09:35:17.926] .../[email protected]/node_modules/cypress postinstall: https://on.cypress.io/opening-the-app
[09:35:17.936] .../[email protected]/node_modules/cypress postinstall: Done
[09:35:18.595] .../node_modules/prisma preinstall$ node scripts/preinstall-entry.js
[09:35:18.646] .../node_modules/prisma preinstall: Done
[09:35:18.720] .../node_modules/@prisma/client postinstall$ node scripts/postinstall.js
[09:35:20.435] .../node_modules/@prisma/client postinstall: prisma:warn We could not find your Prisma schema in the default locations (see: https://pris.ly/d/prisma-schema-location).
[09:35:20.436] .../node_modules/@prisma/client postinstall: If you have a Prisma schema file in a custom path, you will need to run
[09:35:20.436] .../node_modules/@prisma/client postinstall: `prisma generate --schema=./path/to/your/schema.prisma` to generate Prisma Client.
[09:35:20.436] .../node_modules/@prisma/client postinstall: If you do not have a Prisma schema file yet, you can ignore this message.
[09:35:20.449] .../node_modules/@prisma/client postinstall: Done
[09:35:20.889] 
[09:35:20.889] dependencies:
[09:35:20.890] + @clickhouse/client 1.11.1
[09:35:20.890] + @date-fns/utc 1.2.0
[09:35:20.890] + @dicebear/collection 9.2.2
[09:35:20.890] + @dicebear/core 9.2.2
[09:35:20.890] + @fontsource/inter 4.5.15
[09:35:20.890] + @hello-pangea/dnd 17.0.0
[09:35:20.890] + @prisma/client 6.7.0
[09:35:20.890] + @prisma/extension-read-replicas 0.4.1
[09:35:20.891] + @react-spring/web 9.7.5
[09:35:20.891] + @tanstack/react-query 5.74.11
[09:35:20.891] + @umami/redis-client 0.26.0
[09:35:20.891] + bcryptjs 2.4.3
[09:35:20.891] + chalk 4.1.2
[09:35:20.891] + chart.js 4.4.9
[09:35:20.891] + chartjs-adapter-date-fns 3.0.0
[09:35:20.891] + classnames 2.5.1
[09:35:20.891] + colord 2.9.3
[09:35:20.892] + cors 2.8.5
[09:35:20.892] + cross-spawn 7.0.6
[09:35:20.892] + date-fns 2.30.0
[09:35:20.892] + date-fns-tz 1.3.8
[09:35:20.898] + debug 4.4.0
[09:35:20.898] + del 6.1.1
[09:35:20.898] + detect-browser 5.3.0
[09:35:20.898] + dotenv 10.0.0
[09:35:20.898] + eslint-plugin-promise 6.6.0
[09:35:20.898] + fs-extra 10.1.0
[09:35:20.898] + immer 9.0.21
[09:35:20.898] + ipaddr.js 2.2.0
[09:35:20.898] + is-ci 3.0.1
[09:35:20.899] + is-docker 3.0.0
[09:35:20.899] + is-localhost-ip 1.4.0
[09:35:20.899] + isbot 5.1.27
[09:35:20.899] + jsonwebtoken 9.0.2
[09:35:20.899] + kafkajs 2.2.4
[09:35:20.899] + maxmind 4.3.24
[09:35:20.899] + md5 2.3.0
[09:35:20.899] + next 15.3.1
[09:35:20.899] + node-fetch 3.3.2
[09:35:20.899] + npm-run-all 4.1.5
[09:35:20.899] + prisma 6.7.0
[09:35:20.899] + pure-rand 6.1.0
[09:35:20.899] + react 19.1.0
[09:35:20.899] + react-basics 0.126.0
[09:35:20.899] + react-dom 19.1.0
[09:35:20.899] + react-error-boundary 4.1.2
[09:35:20.899] + react-intl 6.8.9
[09:35:20.899] + react-simple-maps 2.3.0
[09:35:20.899] + react-use-measure 2.1.7
[09:35:20.900] + react-window 1.8.11
[09:35:20.900] + request-ip 3.3.0
[09:35:20.900] + semver 7.7.1
[09:35:20.900] + serialize-error 12.0.0
[09:35:20.900] + thenby 1.3.4
[09:35:20.900] + uuid 9.0.1
[09:35:20.900] + zod 3.24.3
[09:35:20.900] + zustand 4.5.6
[09:35:20.900] 
[09:35:20.900] devDependencies:
[09:35:20.900] + @formatjs/cli 4.8.4
[09:35:20.900] + @netlify/plugin-nextjs 5.10.7
[09:35:20.900] + @rollup/plugin-alias 5.1.1
[09:35:20.900] + @rollup/plugin-commonjs 25.0.8
[09:35:20.900] + @rollup/plugin-json 6.1.0
[09:35:20.900] + @rollup/plugin-node-resolve 15.3.1
[09:35:20.901] + @rollup/plugin-replace 5.0.7
[09:35:20.901] + @rollup/plugin-terser 0.4.4
[09:35:20.901] + @svgr/rollup 8.1.0
[09:35:20.901] + @svgr/webpack 8.1.0
[09:35:20.901] + @types/jest 29.5.14
[09:35:20.901] + @types/node 22.15.3
[09:35:20.901] + @types/react 19.1.2
[09:35:20.901] + @types/react-dom 19.1.3
[09:35:20.901] + @types/react-window 1.8.8
[09:35:20.901] + @typescript-eslint/eslint-plugin 6.21.0
[09:35:20.901] + @typescript-eslint/parser 6.21.0
[09:35:20.901] + cross-env 7.0.3
[09:35:20.901] + cypress 13.17.0
[09:35:20.901] + esbuild 0.25.3
[09:35:20.901] + eslint 8.57.1
[09:35:20.901] + eslint-config-next 14.2.28
[09:35:20.901] + eslint-config-prettier 8.10.0
[09:35:20.901] + eslint-import-resolver-alias 1.1.2
[09:35:20.901] + eslint-plugin-css-modules 2.12.0
[09:35:20.901] + eslint-plugin-cypress 2.15.2
[09:35:20.901] + eslint-plugin-import 2.31.0
[09:35:20.901] + eslint-plugin-jest 27.9.0
[09:35:20.901] + eslint-plugin-prettier 4.2.1
[09:35:20.901] + extract-react-intl-messages 4.1.1
[09:35:20.902] + husky 8.0.3
[09:35:20.902] + jest 29.7.0
[09:35:20.902] + lint-staged 14.0.1
[09:35:20.902] + postcss 8.5.3
[09:35:20.902] + postcss-flexbugs-fixes 5.0.2
[09:35:20.902] + postcss-import 15.1.0
[09:35:20.902] + postcss-preset-env 7.8.3
[09:35:20.902] + prettier 2.8.8
[09:35:20.902] + prompts 2.4.2
[09:35:20.902] + rollup 3.29.5
[09:35:20.902] + rollup-plugin-copy 3.5.0
[09:35:20.902] + rollup-plugin-delete 2.2.0
[09:35:20.902] + rollup-plugin-dts 5.3.1
[09:35:20.902] + rollup-plugin-esbuild 5.0.0
[09:35:20.902] + rollup-plugin-node-externals 6.1.2
[09:35:20.902] + rollup-plugin-postcss 4.0.2
[09:35:20.902] + stylelint 15.11.0
[09:35:20.902] + stylelint-config-css-modules 4.4.0
[09:35:20.902] + stylelint-config-prettier 9.0.5
[09:35:20.902] + stylelint-config-recommended 14.0.1
[09:35:20.902] + tar 6.2.1
[09:35:20.902] + ts-jest 29.3.2
[09:35:20.902] + ts-node 10.9.2
[09:35:20.902] + typescript 5.8.3
[09:35:20.902] 
[09:35:21.054] . prepare$ node -e "if (process.env.NODE_ENV !== 'production'){process.exit(1)} " || husky install
[09:35:21.147] . prepare: husky - Git hooks installed
[09:35:21.158] . prepare: Done
[09:35:21.167] Done in 34.6s using pnpm v9.15.9
[09:35:21.186] Detected Next.js version: 15.3.1
[09:35:21.262] Running "pnpm run build"
[09:35:21.653] 
[09:35:21.653] > [email protected] build /vercel/path0
[09:35:21.653] > npm-run-all check-env build-db check-db build-tracker build-geo build-app
[09:35:21.654] 
[09:35:22.203] 
[09:35:22.204] > [email protected] check-env /vercel/path0
[09:35:22.204] > node scripts/check-env.js
[09:35:22.204] 
[09:35:22.648] 
[09:35:22.649] > [email protected] build-db /vercel/path0
[09:35:22.650] > npm-run-all copy-db-files build-db-client
[09:35:22.650] 
[09:35:23.195] 
[09:35:23.196] > [email protected] copy-db-files /vercel/path0
[09:35:23.196] > node scripts/copy-db-files.js
[09:35:23.196] 
[09:35:23.301] Database type detected: postgresql
[09:35:23.309] Copied /vercel/path0/db/postgresql to /vercel/path0/prisma
[09:35:23.737] 
[09:35:23.737] > [email protected] build-db-client /vercel/path0
[09:35:23.737] > prisma generate
[09:35:23.738] 
[09:35:24.343] Prisma schema loaded from prisma/schema.prisma
[09:35:24.491] Warning: You did not specify an output path for your `generator` in schema.prisma. This behavior is deprecated and will no longer be supported in Prisma 7.0.0. To learn more visit https://pris.ly/cli/output-path
[09:35:24.747] 
[09:35:24.748] ✔ Generated Prisma Client (v6.7.0) to ./node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@prisma/client in 184ms
[09:35:24.748] 
[09:35:24.748] Start by importing your Prisma Client (See: https://pris.ly/d/importing-client)
[09:35:24.748] 
[09:35:24.748] Tip: Want real-time updates to your database without manual polling? Discover how with Pulse: https://pris.ly/tip-0-pulse
[09:35:24.748] 
[09:35:25.338] 
[09:35:25.339] > [email protected] check-db /vercel/path0
[09:35:25.340] > node scripts/check-db.js
[09:35:25.340] 
[09:35:25.426] ✓ DATABASE_URL is defined.
[09:35:25.498] ✓ Database connection successful.
[09:35:25.582] ✓ Database version check successful.
[09:37:27.217] Error: P3018
[09:37:27.217] 
[09:37:27.217] A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
[09:37:27.217] 
[09:37:27.217] Migration name: 09_update_hostname_region
[09:37:27.218] 
[09:37:27.218] Database error code: 57014
[09:37:27.218] 
[09:37:27.218] Database error:
[09:37:27.218] ERROR: canceling statement due to statement timeout
[09:37:27.218] 
[09:37:27.218] DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E57014), message: "canceling statement due to statement timeout", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("postgres.c"), line: Some(3330), routine: Some("ProcessInterrupts") }
[09:37:27.219] 
[09:37:27.219] 
[09:37:27.219] ✗ Command failed: prisma migrate deploy
[09:37:27.219] Error: P3018
[09:37:27.219] 
[09:37:27.219] A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
[09:37:27.219] 
[09:37:27.219] Migration name: 09_update_hostname_region
[09:37:27.219] 
[09:37:27.219] Database error code: 57014
[09:37:27.219] 
[09:37:27.220] Database error:
[09:37:27.220] ERROR: canceling statement due to statement timeout
[09:37:27.220] 
[09:37:27.220] DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E57014), message: "canceling statement due to statement timeout", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("postgres.c"), line: Some(3330), routine: Some("ProcessInterrupts") }
[09:37:27.220] 
[09:37:27.220] 
[09:37:27.220] 
[09:37:27.225]  ELIFECYCLE  Command failed with exit code 1.
[09:37:27.241] ERROR: "check-db" exited with 1.
[09:37:27.246]  ELIFECYCLE  Command failed with exit code 1.
[09:37:27.265] Error: Command "pnpm run build" exited with 1
[09:37:27.951] 
[09:37:32.101] Exiting build container

Which Umami version are you using? (if relevant)

v2.18.1

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

vercel

monyasau avatar May 15 '25 08:05 monyasau

You will need to run the build locally so that the migration runs against your database without timing out.

mikecao avatar May 15 '25 21:05 mikecao

Hi @mikecao, I'm having the same issue.
The migration gets stuck during the migration steps on my local machine. Could this be related to my DB provider, Prisma, or Umami?

Thank you!

aialok avatar Jun 04 '25 10:06 aialok

I haven't had a chance to try mike's recommendation so i don't know if it'll work

monyasau avatar Jun 05 '25 01:06 monyasau

@mikecao just had time to try your suggestion, had to fix some prisma issues manually but it worked, thank you very much

monyasau avatar Jun 29 '25 14:06 monyasau