umami-software / umami

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

Issue after upgrade to 2.8.0 #2432

Closed qlaffont closed 8 months ago

qlaffont commented 8 months ago

Describe the Bug

Impossible to load data

Database

PostgreSQL

Relevant log output

⨯ TypeError: g.patchFetch is not a function
8|umami         |     at rD (/apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:13564)
8|umami         |     at /apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:25097
8|umami         |     at AsyncLocalStorage.run (node:async_hooks:346:14)
8|umami         |     at Object.wrap (/apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:13:16241)
8|umami         |     at /apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:24987
8|umami         |     at AsyncLocalStorage.run (node:async_hooks:346:14)
8|umami         |     at Object.wrap (/apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:13:15489)
8|umami         |     at rB (/apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:24914)
8|umami         |     at r7.render (/apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:28962)
8|umami         |     at doRender (/apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/base-server.js:1391:44)
8|umami         |  ⨯ TypeError: g.patchFetch is not a function
8|umami         |     at rD (/apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:13564)
8|umami         |     at /apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:25097
8|umami         |     at AsyncLocalStorage.run (node:async_hooks:346:14)
8|umami         |     at Object.wrap (/apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:13:16241)
8|umami         |     at /apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:24987
8|umami         |     at AsyncLocalStorage.run (node:async_hooks:346:14)
8|umami         |     at Object.wrap (/apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:13:15489)
8|umami         |     at rB (/apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:24914)
8|umami         |     at r7.render (/apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:28962)
8|umami         |     at doRender (/apps/umami/node_modules/.pnpm/next@14.0.4_@babel+core@7.17.7_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/base-server.js:1391:44)
8|umami         | TypeError: i(...).getCache is not a function
8|umami         |     at Object.c [as fetchWebsite] (/apps/umami/.next/server/chunks/8218.js:1:2697)
8|umami         |     at d (/apps/umami/.next/server/chunks/8218.js:1:11947)
8|umami         |     at m (/apps/umami/.next/server/chunks/8218.js:1:14333)
8|umami         |     at o (/apps/umami/.next/server/chunks/8218.js:246:422)
8|umami         |     at Object.prisma (/apps/umami/.next/server/chunks/8218.js:246:242)
8|umami         |     at o (/apps/umami/.next/server/chunks/8218.js:1:8565)
8|umami         |     at u (/apps/umami/.next/server/chunks/8218.js:246:229)
8|umami         |     at m (/apps/umami/.next/server/pages/api/websites/[id]/stats.js:1:4498)
8|umami         | TypeError: i(...).getCache is not a function
8|umami         |     at Object.c [as fetchWebsite] (/apps/umami/.next/server/chunks/8218.js:1:2697)
8|umami         |     at d (/apps/umami/.next/server/chunks/8218.js:1:11947)
8|umami         |     at m (/apps/umami/.next/server/chunks/8218.js:1:14333)
8|umami         |     at o (/apps/umami/.next/server/chunks/8218.js:246:422)
8|umami         |     at Object.prisma (/apps/umami/.next/server/chunks/8218.js:246:242)
8|umami         |     at o (/apps/umami/.next/server/chunks/8218.js:1:8565)
8|umami         |     at u (/apps/umami/.next/server/chunks/8218.js:246:229)
8|umami         |     at m (/apps/umami/.next/server/pages/api/websites/[id]/stats.js:1:4498)


### Which browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

_No response_
qlaffont commented 8 months ago

Failed to compile.

./src/components/common/ErrorBoundary.tsx
ReactServerComponentsError:

The "use client" directive must be placed before other expressions. Move it to the top of the file to resolve this issue.

     ╭─[/apps/umami/node_modules/.pnpm/react-error-boundary@4.0.4_react@18.2.0/node_modules/react-error-boundary/dist/react-error-boundary.module.js:142:1]
 142 │ var $81c1b644006d48ec$exports = {};
 143 │
 144 │
 145 │ "use client";
     · ─────────────
 146 │
 147 │
 148 │ export {$44d7e150ebc754d2$export$e926676385687eaf as ErrorBoundary, $ebb31c7feaa4405e$export$b16d9fb1a22de840 as ErrorBoundaryContext, $7c3c25b3f398a9d6$export$c052f6604b7d51fe as useErrorBoundary, $62ff477d53f02a5b$export$f0c7a449e0cfaec7 as withErrorBoundary};
     ╰────

The error was caused by importing 'react-error-boundary/dist/react-error-boundary.module.js' in './src/components/common/ErrorBoundary.tsx'.

Import path:
  ./src/components/common/ErrorBoundary.tsx
  ./src/app/Providers.tsx

> Build failed because of webpack errors
   Creating an optimized production build  . ELIFECYCLE  Command failed with exit code 1.
ERROR: "build-app" exited with 1.
 ELIFECYCLE  Command failed with exit code 1.z
 ```
mikecao commented 8 months ago

Have you tried using v2.9.0?

qlaffont commented 8 months ago

same in 2.9.0 @mikecao

qlaffont commented 8 months ago

Log:

node -v
v20.10.0
> umami@2.9.0 build-geo /apps/umami
> node scripts/build-geo.js

Saved geo database: /apps/umami/geo/GeoLite2-City.mmdb

> umami@2.9.0 build-app /apps/umami
> next build

   ▲ Next.js 14.0.4
   - Environments: .env

Failed to compile.

./src/components/common/ErrorBoundary.tsx
ReactServerComponentsError:

The "use client" directive must be placed before other expressions. Move it to the top of the file to resolve this issue.

     ╭─[/apps/umami/node_modules/.pnpm/react-error-boundary@4.0.4_react@18.2.0/node_modules/react-error-boundary/dist/react-error-boundary.module.js:142:1]
 142 │ var $81c1b644006d48ec$exports = {};
 143 │
 144 │
 145 │ "use client";
     · ─────────────
 146 │
 147 │
 148 │ export {$44d7e150ebc754d2$export$e926676385687eaf as ErrorBoundary, $ebb31c7feaa4405e$export$b16d9fb1a22de840 as ErrorBoundaryContext, $7c3c25b3f398a9d6$export$c052f6604b7d51fe as useErrorBoundary, $62ff477d53f02a5b$export$f0c7a449e0cfaec7 as withErrorBoundary};
     ╰────

The error was caused by importing 'react-error-boundary/dist/react-error-boundary.module.js' in './src/components/common/ErrorBoundary.tsx'.

Import path:
  ./src/components/common/ErrorBoundary.tsx
  ./src/app/Providers.tsx

> Build failed because of webpack errors
   Creating an optimized production build  . ELIFECYCLE  Command failed with exit code 1.
ERROR: "build-app" exited with 1.
 ELIFECYCLE  Command failed with exit code 1.
mikecao commented 8 months ago

You're just running yarn build? I just pulled from master and it built without issue. You can also try the dev branch.

qlaffont commented 8 months ago

This is the script of what I do :

#!/bin/sh

pm2 stop ecosystem.config.js
git pull
pnpm install
pnpm run build
pm2 start ecosystem.config.js
mikecao commented 8 months ago

Can you try building with yarn?

qlaffont commented 8 months ago

it works ! I can confirm it doesn't work with pnpm :/