medusa icon indicating copy to clipboard operation
medusa copied to clipboard

[Bug]: /store/product-categories can't be sorted

Open SteelRazor47 opened this issue 4 months ago • 0 comments

Package.json file

{
  "name": "medusa-clean-backend",
  "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.8.3",
    "@medusajs/cli": "2.8.3",
    "@medusajs/framework": "2.8.3",
    "@medusajs/medusa": "2.8.3",
    "@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.8.3",
    "@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"
  },
  "packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}

Node.js version

v22.13.1

Database and its version

PostgreSQL 17.2

Operating system name and version

WSL Ubuntu 24.04

Browser name

No response

What happended?

The /store/product-categories endpoint seems to be only sortable by id(which is useless). All other fields, even created/updated_at, and most importantly for me the rank field are ignored. I tried to look a bit into the source to see if there was something different from the other endpoints but couln't see anything wrong.

All other endpoints(collections, product-types etc) behave as expected

Reproduction steps:

  • setup a 2.8.3 starter with default seed data
  • notice output of: curl 'http://localhost:9000/store/product-categories?fields=name&order=name' -H 'x-publishable-api-key: <pk_key>' "Merch" should be the first but isn't(same with other fields like rank etc)

Expected behavior

/store/product-categories?order= should respect the specified order

Actual behavior

the returned order is always the same and seems to be the same as in the dashboard

Link to reproduction repo

as above

SteelRazor47 avatar Jun 02 '25 17:06 SteelRazor47