medusa icon indicating copy to clipboard operation
medusa copied to clipboard

[Bug]: Order changes don't work in 2.5.0

Open rajmahil opened this issue 9 months ago • 18 comments

Package.json file

{
  "name": "next-tst",
  "version": "0.0.1",
  "description": "A starter for Medusa projects.",
  "author": "Medusa (https://medusajs.com)",
  "license": "MIT",
  "keywords": [
    "sqlite",
    "postgres",
    "typescript",
    "ecommerce",
    "headless",
    "medusa"
  ],
  "scripts": {
    "build": "medusa build",
    "seed": "medusa exec ./src/scripts/seed.ts",
    "start": "medusa start",
    "dev": "medusa develop",
    "test:integration:http": "TEST_TYPE=integration:http NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit",
    "test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit",
    "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit"
  },
  "dependencies": {
    "@medusajs/admin-sdk": "2.5.0",
    "@medusajs/cli": "2.5.0",
    "@medusajs/framework": "2.5.0",
    "@medusajs/medusa": "2.5.0",
    "@mikro-orm/core": "6.4.3",
    "@mikro-orm/knex": "6.4.3",
    "@mikro-orm/migrations": "6.4.3",
    "@mikro-orm/postgresql": "6.4.3",
    "awilix": "^8.0.1",
    "pg": "^8.13.0"
  },
  "devDependencies": {
    "@medusajs/test-utils": "2.5.0",
    "@mikro-orm/cli": "6.4.3",
    "@swc/core": "1.5.7",
    "@swc/jest": "^0.2.36",
    "@types/jest": "^29.5.13",
    "@types/node": "^20.0.0",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.2.25",
    "jest": "^29.7.0",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",
    "vite": "^5.2.11",
    "yalc": "^1.0.0-pre.53"
  },
  "engines": {
    "node": ">=20"
  }
}

Node.js version

"node": ">=20"

Database and its version

16.2

Operating system name and version

MacOs

Browser name

chrome

What happended?

Order changes don't behave as expected in medusa 2.5.0. As soon you create an order you are either redirected to the main /orders page, or get an error "Error: An active Order Change is required to proceed". This only happens in 2.5.0, 2.4.0 it behaves as expected.

Expected behavior

A order change dialog should appear when an order change is created to confirm the action

Actual behavior

You are either redirect to the /orders page or get an error "Error: An active Order Change is required to proceed".

Link to reproduction repo

https://github.com/rajmahil/medusa-2.5.0-error

rajmahil avatar Feb 12 '25 00:02 rajmahil

https://github.com/user-attachments/assets/84501e3d-74ff-4582-8e0b-b68e85973a9f

rajmahil avatar Feb 12 '25 00:02 rajmahil

Hey @rajmahil, I am unable to reproduce in a fresh project with 2.5.0 installed. Could I get you to purge your node_modules and run a re-install? It might be a dependency mess causing this issue.

olivermrbl avatar Feb 12 '25 08:02 olivermrbl

https://github.com/user-attachments/assets/219f1c59-01f1-4df8-b23d-ea6fffd4e575

@olivermrbl , thanks for looking into this! I just installed a fresh project (2.5.0), i'm still running into the same sorts of errors. Is there something i'm missing??

{ "name": "my-medusa-store", "version": "0.0.1", "description": "A starter for Medusa projects.", "author": "Medusa (https://medusajs.com)", "license": "MIT", "keywords": [ "sqlite", "postgres", "typescript", "ecommerce", "headless", "medusa" ], "scripts": { "build": "medusa build", "seed": "medusa exec ./src/scripts/seed.ts", "start": "medusa start", "dev": "medusa develop", "test:integration:http": "TEST_TYPE=integration:http NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit", "test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit", "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit" }, "dependencies": { "@medusajs/admin-sdk": "2.5.0", "@medusajs/cli": "2.5.0", "@medusajs/framework": "2.5.0", "@medusajs/medusa": "2.5.0", "@mikro-orm/core": "6.4.3", "@mikro-orm/knex": "6.4.3", "@mikro-orm/migrations": "6.4.3", "@mikro-orm/postgresql": "6.4.3", "awilix": "^8.0.1", "pg": "^8.13.0" }, "devDependencies": { "@medusajs/test-utils": "2.5.0", "@mikro-orm/cli": "6.4.3", "@swc/core": "1.5.7", "@swc/jest": "^0.2.36", "@types/jest": "^29.5.13", "@types/node": "^20.0.0", "@types/react": "^18.3.2", "@types/react-dom": "^18.2.25", "jest": "^29.7.0", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", "ts-node": "^10.9.2", "typescript": "^5.6.2", "vite": "^5.2.11", "yalc": "^1.0.0-pre.53" }, "engines": { "node": ">=20" } }

rajmahil avatar Feb 12 '25 17:02 rajmahil

Hey @rajmahil, I can't reproduce this with a fresh start either. Can you record one with this https://jam.dev/ and share it here?

Additionally, your entire server logs from running yarn dev would also be helpful

riqwan avatar Feb 13 '25 10:02 riqwan

@riqwan Hey, thanks i really appreciate your help!

Here is the link to the jam video: https://jam.dev/c/6b7e8df4-f31a-4082-b630-ff94106ce783

I've also included the logs below for your reference. Any help would be much appreciated!!!

log copy.txt

rajmahil avatar Feb 13 '25 23:02 rajmahil

Hey @rajmahil, can you do the jam video from a fresh one? The one you recorded seems to have a widget in there that might skew the debugging

riqwan avatar Feb 14 '25 00:02 riqwan

@riqwan Hey! Thanks again for looking in to this again.

Please see the link for jam video on a fresh install: https://jam.dev/c/404d3e19-7134-4b99-b223-421e1f84555f

I've also attached the logs below for run dev.

log.txt

I also did a fresh install from a completely different machine and ran into similar issues. I feel like i'm missing something here:(

rajmahil avatar Feb 14 '25 04:02 rajmahil

@riqwan

For further context....

I usually get one of two behaviours.

  1. "An active Order Change is required to proceed" error message upon creating an order edit. In the database, the entry on the table "order_change" is marked as deleted immediately upon clicking "confirm edit". Even though the order change is still pending.

  2. Upon "Confirm edit" for the order change, I get a success message, but i'm redirected immediately to the "/app/orders" route. Similar to scenario one, the order change is marked as deleted, even though it it still pending.

rajmahil avatar Feb 14 '25 04:02 rajmahil

First look, I can't see anything obviously wrong here, aside from the errors I see there. The change order getting deleted is a good hint to narrow the scope. Will take a deeper look on Monday/Tuesday.

Can you confirm if you're using a fresh database and migrating them from scratch as well when you're launching a new project?

riqwan avatar Feb 14 '25 14:02 riqwan

That's correct, i'm doing everything from scratch on a new install!

rajmahil avatar Feb 14 '25 15:02 rajmahil

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 3 days.

github-actions[bot] avatar Mar 18 '25 02:03 github-actions[bot]

@rajmahil did you ever get a resolution here? I'm now running into the same issue on 2.6.1

turacma avatar Mar 21 '25 23:03 turacma

To be clear, I upgraded from 2.4.0 to 2.6.1 and after the upgrade I can no longer edit orders with the same error described in this thread.

turacma avatar Mar 21 '25 23:03 turacma

@turacma

Intalling radix-ui in my project solved this, but i'm still not 100% sure what the exact issue was/is. I was also facing some other weird UI issues as well.

rajmahil avatar Mar 27 '25 03:03 rajmahil

@rajmahil, thanks! Installing radix-ui explicitly in my project seems to have fixed this for me as well.

turacma avatar Apr 01 '25 19:04 turacma

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 3 days.

github-actions[bot] avatar May 04 '25 02:05 github-actions[bot]

I guess it's the same issue. For example, "cancel" the order does not reflect on the orders overview. Only on a hard reload. Version 2.8.2 Image

gp-slick-coder avatar May 19 '25 10:05 gp-slick-coder

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 3 days.

github-actions[bot] avatar Jun 19 '25 02:06 github-actions[bot]

This issue was closed because it has been stalled for 3 days with no activity.

github-actions[bot] avatar Jun 24 '25 02:06 github-actions[bot]