umami-software / umami

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

1.29.2 doesn't work on Heroku πŸ˜” (jsxDEV is not a function error) #1071

Closed KonstantinReido closed 2 years ago

KonstantinReido commented 2 years ago

Updated on the latest version 1.29.2. Deployed on Heroku. Faced with the next issue (appears on any request to my server)

2022-04-04T18:41:33.492055+00:00 app[web.1]: TypeError: (0 , react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV) is not a function
2022-04-04T18:41:33.492065+00:00 app[web.1]: at App (webpack-internal:///./pages/_app.js:69:96)
2022-04-04T18:41:33.492066+00:00 app[web.1]: at d (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:33:498)
2022-04-04T18:41:33.492066+00:00 app[web.1]: at bb (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:16)
2022-04-04T18:41:33.492067+00:00 app[web.1]: at a.b.render (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:42:43)
2022-04-04T18:41:33.492067+00:00 app[web.1]: at a.b.read (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
2022-04-04T18:41:33.492068+00:00 app[web.1]: at Object.exports.renderToString (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:52:138)
2022-04-04T18:41:33.492068+00:00 app[web.1]: at Object.renderPage (/app/node_modules/next/dist/server/render.js:768:45)
2022-04-04T18:41:33.492069+00:00 app[web.1]: at Object.defaultGetInitialProps (/app/node_modules/next/dist/server/render.js:375:51)
2022-04-04T18:41:33.492069+00:00 app[web.1]: at Function.getInitialProps (webpack-internal:///./node_modules/next/dist/pages/_document.js:173:20)
2022-04-04T18:41:33.492069+00:00 app[web.1]: at Object.loadGetInitialProps (/app/node_modules/next/dist/shared/lib/utils.js:65:29)

Deployment logs:

remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/nodejs
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        USE_YARN_CACHE=true
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:        engines.yarn (package.json):  unspecified (use default)
remote:
remote:        Resolving node version 16.x...
remote:        Downloading and installing node 16.14.2...
remote:        Using default npm version: 8.5.0
remote:        Resolving yarn version 1.22.x...
remote:        Downloading and installing yarn (1.22.18)
remote:        Installed yarn 1.22.18
remote:
remote: -----> Restoring cache
remote:        - yarn cache
remote:
remote: -----> Installing dependencies
remote:        Installing node modules (yarn.lock)
remote:        yarn install v1.22.18
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        [3/4] Linking dependencies...
remote:        warning "react-spring > @react-spring/konva@9.4.4" has unmet peer dependency "konva@>=2.6".
remote:        warning "react-spring > @react-spring/konva@9.4.4" has unmet peer dependency "react-konva@^16.8.0  || ^17.0.0".
remote:        warning "react-spring > @react-spring/native@9.4.4" has unmet peer dependency "react-native@>=0.58".
remote:        warning "react-spring > @react-spring/three@9.4.4" has unmet peer dependency "@react-three/fiber@>=6.0".
remote:        warning "react-spring > @react-spring/three@9.4.4" has unmet peer dependency "three@>=0.126".
remote:        warning "react-spring > @react-spring/zdog@9.4.4" has unmet peer dependency "react-zdog@>=1.0".
remote:        warning "react-spring > @react-spring/zdog@9.4.4" has unmet peer dependency "zdog@>=1.0".
remote:        warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
remote:        [4/4] Building fresh packages...
remote:        $ husky install
remote:        fatal: not a git repository (or any parent up to mount point /)
remote:        Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
remote:        Done in 30.37s.
remote:
remote: -----> Build
remote:        Running build (yarn)
remote:        yarn run v1.22.18
remote:        $ npm-run-all build-tracker build-geo build-db build-app
remote:        $ rollup -c rollup.tracker.config.js
remote:
remote: tracker/index.js β†’ public/umami.js...
remote: created public/umami.js in 343ms
remote:        $ node scripts/build-geo.js
remote:        Saved geo database: /tmp/build_7b2f3c9a/public/geo/GeoLite2-Country.mmdb
remote:        $ npm-run-all copy-db-schema build-db-client
remote:        $ node scripts/copy-db-schema.js
remote:        Database type detected: postgresql
remote:        Copied /tmp/build_7b2f3c9a/prisma/schema.postgresql.prisma to /tmp/build_7b2f3c9a/prisma/schema.prisma
remote:        $ dotenv prisma generate
remote:        Prisma schema loaded from prisma/schema.prisma
remote:
remote:        βœ” Generated Prisma Client (3.11.1 | library) to ./node_modules/@prisma/client in 197ms
remote:        You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
remote:        ```
remote:        import { PrismaClient } from '@prisma/client'
remote:        const prisma = new PrismaClient()
remote:        ```
remote:        $ next build
remote:        warn  - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
remote:        Attention: Next.js now collects completely anonymous telemetry regarding usage.
remote:        This information is used to shape Next.js' roadmap and prioritize features.
remote:        You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
remote:        https://nextjs.org/telemetry
remote:
remote:        info  - Checking validity of types...
remote:        info  - Creating an optimized production build...
remote: warn  - using beta Middleware (not covered by semver) - https://nextjs.org/docs/messages/beta-middleware
remote:        info  - Compiled successfully
remote:        info  - Collecting page data...
remote:        info  - Generating static pages (0/13)
remote:        info  - Generating static pages (3/13)
remote:        info  - Generating static pages (6/13)
remote:        info  - Generating static pages (9/13)
remote:        info  - Generating static pages (13/13)
remote:        info  - Finalizing page optimization...
remote:
remote:        Page                                       Size     First Load JS
remote:        β”Œ β—‹ /                                      296 B           148 kB
remote:        β”œ   /_app                                  0 B             148 kB
remote:        β”œ Ζ’ /_middleware                           26.8 kB         174 kB
remote:        β”œ β—‹ /404                                   369 B           201 kB
remote:        β”œ   β”” css/ce16c43b6179ab29.css             1.98 kB
remote:        β”œ Ξ» /api/account                           0 B             148 kB
remote:        β”œ Ξ» /api/account/[id]                      0 B             148 kB
remote:        β”œ Ξ» /api/account/password                  0 B             148 kB
remote:        β”œ Ξ» /api/accounts                          0 B             148 kB
remote:        β”œ Ξ» /api/auth/login                        0 B             148 kB
remote:        β”œ Ξ» /api/auth/verify                       0 B             148 kB
remote:        β”œ Ξ» /api/collect                           0 B             148 kB
remote:        β”œ Ξ» /api/realtime/init                     0 B             148 kB
remote:        β”œ Ξ» /api/realtime/update                   0 B             148 kB
remote:        β”œ Ξ» /api/share/[id]                        0 B             148 kB
remote:        β”œ Ξ» /api/website                           0 B             148 kB
remote:        β”œ Ξ» /api/website/[id]                      0 B             148 kB
remote:        β”œ Ξ» /api/website/[id]/active               0 B             148 kB
remote:        β”œ Ξ» /api/website/[id]/events               0 B             148 kB
remote:        β”œ Ξ» /api/website/[id]/metrics              0 B             148 kB
remote:        β”œ Ξ» /api/website/[id]/pageviews            0 B             148 kB
remote:        β”œ Ξ» /api/website/[id]/reset                0 B             148 kB
remote:        β”œ Ξ» /api/website/[id]/stats                0 B             148 kB
remote:        β”œ Ξ» /api/websites                          0 B             148 kB
remote:        β”œ β—‹ /dashboard/[[...id]]                   4.91 kB         344 kB
remote:        β”œ   β”” css/dc940475c0e80305.css             253 B
remote:        β”œ β—‹ /login                                 2 kB            214 kB
remote:        β”œ   β”” css/5c57a357791fbdf5.css             2.38 kB
remote:        β”œ β—‹ /logout                                337 B           148 kB
remote:        β”œ β—‹ /realtime                              5.44 kB         369 kB
remote:        β”œ   β”” css/8a235520c4f47a5f.css             3.68 kB
remote:        β”œ β—‹ /settings                              228 B           321 kB
remote:        β”œ β—‹ /settings/accounts                     267 B           321 kB
remote:        β”œ β—‹ /settings/profile                      265 B           321 kB
remote:        β”œ β—‹ /share/[...id]                         427 B           394 kB
remote:        β”œ β—‹ /test                                  4.93 kB         344 kB
remote:        β”œ   β”” css/1959cedf26ee68ed.css             280 B
remote:        β”” β—‹ /website/[...id]                       1.38 kB         395 kB
remote:        + First Load JS shared by all              148 kB
remote:          β”œ chunks/framework-5f4595e5518b5600.js   42 kB
remote:          β”œ chunks/main-7c9e8fd8226b6573.js        28.2 kB
remote:          β”œ chunks/pages/_app-2fb3d8df91272d4a.js  76.4 kB
remote:          β”œ chunks/webpack-cb7634a8b6194820.js     884 B
remote:          β”” css/2b825f07a02cea87.css               9.39 kB
remote:
remote:        Ζ’  (Middleware)  intercepts requests (uses _middleware)
remote:        Ξ»  (Server)      server-side renders at runtime (uses getInitialProps or getServerSideProps)
remote:        β—‹  (Static)      automatically rendered as static HTML (uses no initial props)
remote:
remote:        $ node scripts/postbuild.js
remote:        Done in 50.12s.
remote:
remote: -----> Pruning devDependencies
remote:        yarn install v1.22.18
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        [3/4] Linking dependencies...
remote:        warning "react-spring > @react-spring/konva@9.4.4" has unmet peer dependency "konva@>=2.6".
remote:        warning "react-spring > @react-spring/konva@9.4.4" has unmet peer dependency "react-konva@^16.8.0  || ^17.0.0".
remote:        warning "react-spring > @react-spring/native@9.4.4" has unmet peer dependency "react-native@>=0.58".
remote:        warning "react-spring > @react-spring/three@9.4.4" has unmet peer dependency "@react-three/fiber@>=6.0".
remote:        warning "react-spring > @react-spring/three@9.4.4" has unmet peer dependency "three@>=0.126".
remote:        warning "react-spring > @react-spring/zdog@9.4.4" has unmet peer dependency "react-zdog@>=1.0".
remote:        warning "react-spring > @react-spring/zdog@9.4.4" has unmet peer dependency "zdog@>=1.0".
remote:        warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
remote:        [4/4] Building fresh packages...
remote:        warning Ignored scripts due to flag.
remote:        Done in 3.78s.
remote:
remote: -----> Caching build
remote:        - yarn cache
remote:
remote: -----> Build succeeded!
remote:  !     Unmet dependencies don't fail yarn install but may cause runtime issues
remote:        https://github.com/npm/npm/issues/7494
Sammy-T commented 2 years ago

My installation of v1.29.2 on Heroku produces a 500 server error when I try to pull up the dashboard. I've had to roll it back for now.

tbkblues commented 2 years ago

Same

Justin-Jordan commented 2 years ago

Same

bonesoul commented 2 years ago

same here also, any fixes?

af1 commented 2 years ago

Heroku gives me:

We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy.

KonstantinReido commented 2 years ago

The same for v1.30.0 πŸ˜”

giuliomagnifico commented 2 years ago

+1 same here on Heroku and same also on Railway.

ChadoNihi commented 2 years ago

As a "workaround", I ended up deploying to Vercel w/ a managed PostgreSQL database on Railway. Deploying everything to Railway didn't work w/ a custom script name for me (Umami didn't track a website usage when the script was renamed, despite TRACKER_SCRIPT_NAME env variable being set.)

resurgeae commented 2 years ago

any solution

af1 commented 2 years ago

any solution

deploy to railway

wachukxs commented 2 years ago

any solution

Quickest (and probably laziest) fix: revert to the last stable version that works on Heroku. You won't need to change anything else!

Run: git checkout 2b4ddb5388d6d9a3a1760f71acbe373acdb4dec5 (takes you to v1.28.0) git push -f heroku HEAD:master

giuliomagnifico commented 2 years ago

Works also on Railway but I think the Heroku trouble must be fixed or removed from the β€œHow to install Umami” because it simply doesn’t work.

mikecao commented 2 years ago

We're going to revert to Next 12.1.0 in the next version until Heroku fixes their issues.

mikecao commented 2 years ago

Fixed in version v1.31.0

KonstantinReido commented 2 years ago

@mikecao it's happened again with v1.36.1 πŸ˜”

On each request I see in logs:

2022-07-27T20:07:35.055637+00:00 app[web.1]: TypeError: (0 , react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV) is not a function
2022-07-27T20:07:35.055647+00:00 app[web.1]: at App (webpack-internal:///./pages/_app.js:68:96)
2022-07-27T20:07:35.055647+00:00 app[web.1]: at d (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:33:498)
2022-07-27T20:07:35.055647+00:00 app[web.1]: at bb (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:16)
2022-07-27T20:07:35.055648+00:00 app[web.1]: at a.b.render (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:42:43)
2022-07-27T20:07:35.055648+00:00 app[web.1]: at a.b.read (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
2022-07-27T20:07:35.055650+00:00 app[web.1]: at Object.exports.renderToString (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:52:138)
2022-07-27T20:07:35.055650+00:00 app[web.1]: at Object.renderPage (/app/node_modules/next/dist/server/render.js:756:46)
2022-07-27T20:07:35.055651+00:00 app[web.1]: at Object.defaultGetInitialProps (/app/node_modules/next/dist/server/render.js:369:51)
2022-07-27T20:07:35.055651+00:00 app[web.1]: at Function.getInitialProps (webpack-internal:///./node_modules/next/dist/pages/_document.js:21:20)
2022-07-27T20:07:35.055651+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/next/dist/shared/lib/utils.js:103:33)

Also, I noticed that during system load was the next error:

2022-07-27T20:07:10.871243+00:00 app[web.1]: error - ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[7].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[2].oneOf[7].use[2]!./node_modules/@fontsource/inter/400.css
2022-07-27T20:07:10.871252+00:00 app[web.1]: Error: Cannot find module 'postcss-rtlcss'
2022-07-27T20:07:10.871253+00:00 app[web.1]: Require stack:
2022-07-27T20:07:10.871254+00:00 app[web.1]: - /app/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
2022-07-27T20:07:10.871254+00:00 app[web.1]: - /app/node_modules/next/dist/build/webpack/config/blocks/css/index.js
2022-07-27T20:07:10.871255+00:00 app[web.1]: - /app/node_modules/next/dist/build/webpack/config/index.js
2022-07-27T20:07:10.871255+00:00 app[web.1]: - /app/node_modules/next/dist/build/webpack-config.js
2022-07-27T20:07:10.871255+00:00 app[web.1]: - /app/node_modules/next/dist/server/dev/hot-reloader.js
2022-07-27T20:07:10.871255+00:00 app[web.1]: - /app/node_modules/next/dist/server/dev/next-dev-server.js
2022-07-27T20:07:10.871256+00:00 app[web.1]: - /app/node_modules/next/dist/server/next.js
2022-07-27T20:07:10.871256+00:00 app[web.1]: - /app/node_modules/next/dist/server/lib/start-server.js
2022-07-27T20:07:10.871256+00:00 app[web.1]: - /app/node_modules/next/dist/cli/next-start.js
2022-07-27T20:07:10.871257+00:00 app[web.1]: - /app/scripts/start-env.js
2022-07-27T20:07:10.871257+00:00 app[web.1]: at Array.map (<anonymous>)

Environment: Heroku

mikecao commented 2 years ago

@KonstantinReido We've upgraded to the latest version of Next.js in recent versions. We can't remain stuck on an old version just to support Heroku, especially since Heroku is the only provider that has this problem.

Your options are to:

  1. Contact Heroku support and have them figure out why they can't build Next.js apps
  2. Migrate the app to somewhere else like Vercel. You can still connect to your database at Heroku if you host it there.
  3. Keep using an old version that works with Heroku.