medusajs / medusa

Building blocks for digital commerce
https://medusajs.com
MIT License
24.67k stars 2.43k forks source link

Issue with Editing Pricelists after latest medusa update (core & admin) #5348

Closed brendansimcox closed 10 months ago

brendansimcox commented 11 months ago

Issue Summary

We have upgraded our staging environment as a pre-release test before deploying to production but found that the edit price list functionality isn't working

All packages are updated to the latest and manually added medusa-react to the latest as a dependency, running node 16, but getting this issue

Unexpected Application Error!
(0 , en.useAdminDeletePriceListProductsPrices) is not a function
TypeError: (0 , en.useAdminDeletePriceListProductsPrices) is not a function
    at Os (https://ommitedurl/app/918.af1075aa.chunk.js:1:1253518)
    at oO (https://ommitedurl/app/main.1be561c0.js:18:60913)
    at u (https://ommitedurl/app/main.1be561c0.js:18:119434)
    at sI (https://ommitedurl/app/main.1be561c0.js:18:99087)
    at https://ommitedurl/app/main.1be561c0.js:18:98954
    at sN (https://ommitedurl/app/main.1be561c0.js:18:98961)
    at sP (https://ommitedurl/app/main.1be561c0.js:18:95713)
    at s_ (https://ommitedurl/app/main.1be561c0.js:18:96102)
    at n6 (https://ommitedurl/app/main.1be561c0.js:18:44823)
    at https://ommitedurl/app/main.1be561c0.js:18:93613

Steps to reproduce

  1. upgrade all packages to latest medusa (medusa, medusa-admin and all supporting packages)
  2. go to prices lists
  3. select a price list to edit
  4. error shows

package.json

"dependencies": {
    "@medusajs/admin": "^7.1.4",
    "@medusajs/cache-redis": "1.8.8",
    "@medusajs/event-bus-redis": "1.8.8",
    "@medusajs/inventory": "^1.9.1",
    "@medusajs/medusa": "^1.17.1",
    "@medusajs/medusa-cli": "^1.3.21",
    "@medusajs/medusa-oas-cli": "0.2.20-snapshot-20230921172817",
    "@medusajs/types": "^1.11.2",
    "@medusajs/utils": "^1.10.3",
    "@medusajs/workflows": "^0.2.3",
    "@radix-ui/react-dialog": "^1.0.5",
    "@tanstack/react-query": "^4.36.1",
    "medusa-extender": "^1.8.8",
    "medusa-file-s3": "^1.3.1",
    "medusa-fulfillment-manual": "^1.1.38",
    "medusa-interfaces": "^1.3.7",
    "medusa-payment-manual": "^1.0.24",
    "medusa-payment-paypal": "^6.0.2",
    "medusa-payment-stripe": "^6.0.4",
    "medusa-plugin-meilisearch": "^2.0.8",
    "medusa-plugin-sendgrid": "^1.3.11",
    "medusa-plugin-ses": "^2.0.17",
    "medusa-plugin-wishlist": "^1.1.43",
    "medusa-react": "^9.0.7",
    "typeorm": "^0.3.17",
    "yarn": "^1.22.19"
  },
  "repository": "https://github.com/medusajs/medusa-starter-default.git",
  "keywords": [
    "sqlite",
    "ecommerce",
    "headless",
    "medusa"
  ],
  "devDependencies": {
    "@babel/cli": "^7.22.5",
    "@babel/core": "^7.22.5",
    "@babel/preset-typescript": "^7.22.5",
    "babel-preset-medusa-package": "^1.1.19",
    "nodemon": "^2.0.22",
    "patch-package": "^8.0.0",
    "postinstall-postinstall": "^2.1.0",
    "typescript": "^5.1.6"
  }
milan-zami-tech commented 11 months ago

After updating the project, I had a problem viewing Pricing in the admin panel. It didn't show at all. Fixed it by deleting .cache folder. Hope this helps.

olivermrbl commented 11 months ago

@brendansimcox – can you successfully run the project locally? If so, this could indicate that there's an issue with your lock-file.

brendansimcox commented 11 months ago

@olivermrbl will attempt running it locally tomorrow morning and try with a fresh lock file, see if that makes any difference and then report back., ty

brendansimcox commented 11 months ago

@olivermrbl removed the lock file and reinstalled on development environment which was successful, but now we're finding a secondary issue, the edit price list loads - but the request to the products within the pricelist times out, which seems to be crashing the medusa service - resulting in us needing to restart the service.

This is the request url:

/admin/price-lists/pl_01H93E3WTH55PKX9D2DZH9DJ4B/products?limit=10&offset=0&expand=variants%2Ccollection

Screenshot of time out below.

image

The only thing different in my package.json from above is

"@medusajs/medusa-oas-cli": "0.2.20-snapshot-20230921172817" < Removed

brendansimcox commented 11 months ago

@olivermrbl hey buddy - do you happen to know if this is something you've been able to reproduce?

olivermrbl commented 10 months ago

@brendansimcox, sorry for the slow follow-up. Did you manage to solve your issue?

brendansimcox commented 10 months ago

Unfortunately not, we’re on 1.17.1 and still getting the timeout, can’t currently upgrade to 1.17.2 as we need to refactor a big chunk of api routes , but yeah, can’t get past the timeouts on the pricing lists, so stuck with a broken production ( which is currently on 1.16 and we don’t wanna risk updating when we can’t get our staging functional )

brendansimcox commented 10 months ago

@olivermrbl I think i've found the issue - when opening the price list base page, there seems to be a network request to /admin/products with a limit=0, in our case we have approx 18,000 products and its timing out the server whilst it prepares the response, which is roughly 32mb (and 40-50seconds)

image

brendansimcox commented 10 months ago

@olivermrbl this seems to be across 1.17.1 / 2 / 3 from what I can see, currently can't see the root of the issue, we're scouring through admin-ui package atm - seems to be triggered the first time you visit /a/pricing - looks to be trying to preload the full price list.

olivermrbl commented 10 months ago

Thanks for sharing @brendansimcox. @kasperkristensen could you investigate this?

brendansimcox commented 10 months ago

@kasperkristensen would it be possible to get a snapshot that we can install when this is approved?

brendansimcox commented 10 months ago

hey @olivermrbl @kasperkristensen just tested this locally with yarn medusa develop and the snapshots and still getting the network request with limit=0

olivermrbl commented 10 months ago

@brendansimcox, you'll need an admin snapshot. I'll publish one for you now :)

brendansimcox commented 10 months ago

thatnks @olivermrbl

olivermrbl commented 10 months ago

Try this one:

@medusajs/admin@7.1.7-next-20231102164835
brendansimcox commented 10 months ago

thanks @olivermrbl trying now

brendansimcox commented 10 months ago

all sorted, thank you both; @olivermrbl @kasperkristensen