medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
25.78k stars 2.57k forks source link

Admin UI: Invite link causes app error - useAnalytics must be used within a AnalyticsProvider #5096

Closed jpizzle34 closed 1 year ago

jpizzle34 commented 1 year ago

Bug report

Describe the bug

Accessing an invite link causes the admin app to break with Error: useAnalytics must be used within a AnalyticsProvider

System information

Medusa version (including plugins): 1.16.0 Node.js version: Database: postgres Operating system: ubuntu 20.04 lts, railway env Browser (if relevant): Chrome, Firefox

  "dependencies": {
    "@medusajs/admin": "^7.1.0",
    "@medusajs/cache-inmemory": "^1.8.8",
    "@medusajs/cache-redis": "^1.8.8",
    "@medusajs/event-bus-local": "^1.9.6",
    "@medusajs/event-bus-redis": "^1.8.9",
    "@medusajs/file-local": "^1.0.2",
    "@medusajs/icons": "^1.0.0",
    "@medusajs/medusa": "^1.16.0",
    "@medusajs/ui": "^1.0.0",
    "@tanstack/react-query": "4.22.0",
    "body-parser": "^1.19.0",
    "cors": "^2.8.5",
    "dotenv": "16.0.3",
    "express": "^4.17.2",
    "medusa-fulfillment-manual": "^1.1.38",
    "medusa-interfaces": "^1.3.7",
    "medusa-payment-manual": "^1.0.24",
    "medusa-payment-stripe": "^6.0.3",
    "prism-react-renderer": "^2.0.4",
    "typeorm": "^0.3.16"
  },
  "devDependencies": {
    "@babel/cli": "^7.14.3",
    "@babel/core": "^7.14.3",
    "@babel/preset-typescript": "^7.21.4",
    "@medusajs/medusa-cli": "^1.3.16",
    "@types/express": "^4.17.13",
    "@types/jest": "^27.4.0",
    "@types/node": "^17.0.8",
    "babel-preset-medusa-package": "^1.1.13",
    "cross-env": "^7.0.3",
    "eslint": "^6.8.0",
    "jest": "^27.3.1",
    "mongoose": "^5.13.14",
    "rimraf": "^3.0.2",
    "ts-jest": "^27.0.7",
    "ts-loader": "^9.2.6",
    "typescript": "^4.5.2"
  },

Steps to reproduce the behavior

  1. Create new medusa project with pnpm create medusa-app@latest --db-url "postgres://....."
  2. Update deps to "@medusajs/admin": "^7.1.0" and "@medusajs/medusa": "^1.16.0"
  3. Login
  4. Click on 'Settings' > 'The Team' > 'Invite new user'
  5. Copy invite link and access in a new tab/window (incognito)

Expected behavior

Invite link should navigate to user account init page

Screenshots

If applicable, add screenshots to help explain your problem

Code snippets

Stack Trace:

Error
useAnalytics must be used within a AnalyticsProvider
Call Stack
 useAnalytics
  webpack-internal:///68436:247:15
 InvitePage
  webpack-internal:///7185:278:102
 renderWithHooks
  webpack-internal:///91344:16305:18
 updateFunctionComponent
  webpack-internal:///91344:19583:20
 mountLazyComponent
  webpack-internal:///91344:19954:17
 beginWork
  webpack-internal:///91344:21588:16
 HTMLUnknownElement.callCallback
  webpack-internal:///91344:4164:14
 Object.invokeGuardedCallbackDev
  webpack-internal:///91344:4213:16
 invokeGuardedCallback
  webpack-internal:///91344:4277:31
 beginWork$1
  webpack-internal:///91344:27446:7

Additional context

Add any other context about the problem here

olivermrbl commented 1 year ago

@jpizzle34 – thanks for highlighting. Solved in #5111. Will be part of next release 👍

OfficialCRUGG commented 1 year ago

What do I do until the next release is out? This is the URL that opens in the Medusa installation process. How else would I set the password for my default admin user?

olivermrbl commented 1 year ago

You can use our CLI to create a new user in the meantime:

npx @medusajs/medusa-cli user -e some@email.dk -p some_password
OfficialCRUGG commented 1 year ago

That doesn't seem to work on a fresh create-medusa-app install. The command runs, but when I try to log in on the admin login, it says that it doesn't match the records.

skdishansachin commented 9 months ago

That doesn't seem to work on a fresh create-medusa-app install. The command runs, but when I try to log in on the admin login, it says that it doesn't match the records.

I am facing the same issue. Did you find any working solution?