Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Get Cart always return code 200 #10218

Open
Deroswent opened this issue Nov 22, 2024 · 5 comments
Open

[Bug]: Get Cart always return code 200 #10218

Deroswent opened this issue Nov 22, 2024 · 5 comments

Comments

@Deroswent
Copy link

Deroswent commented Nov 22, 2024

Package.json file

{
  "name": "medusa-starter-default",
  "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": "latest",
    "@medusajs/cli": "latest",
    "@medusajs/framework": "latest",
    "@medusajs/medusa": "latest",
    "@mikro-orm/core": "5.9.7",
    "@mikro-orm/knex": "5.9.7",
    "@mikro-orm/migrations": "5.9.7",
    "@mikro-orm/postgresql": "5.9.7",
    "1c_integration": "github:Deroswent/1c_integration",
    "awilix": "^8.0.1",
    "managers": "github:Deroswent/managers",
    "pg": "^8.13.0"
  },
  "devDependencies": {
    "@medusajs/test-utils": "latest",
    "@mikro-orm/cli": "5.9.7",
    "@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"
  },
  "engines": {
    "node": ">=20"
  }
}

Node.js version

v22.11.0

Database and its version

PostgreSQL 16.1

Operating system name and version

Ubuntu 24.04

Browser name

No response

What happended?

Using the store's Api Get Cart /store/carts/{id} you can pass any {id} value, and you will always get the response code 200, although such a cart does not exist.

Expected behavior

A response code of 404 not found is expected.

Actual behavior

You will always get the response code 200, although such a cart id does not exist.

Link to reproduction repo

https://github.com/medusajs/medusa

@suvanbanerjee
Copy link

It seems the issue might be with the hardcoded return code in the referenced file:

res.status(200).json({ cart })
https://github.com/medusajs/medusa/blob/78e68a0bb635060fb2d335bb6dbda566afc06a17/packages/medusa/src/api/store/carts/%5Bid%5D/route.ts#L45C1-L45C33

I’d like to contribute by solving this issue. Could I work on it?

Copy link
Contributor

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 github-actions bot added the Stale label Dec 29, 2024
@Deroswent
Copy link
Author

any updates?

@github-actions github-actions bot removed the Stale label Jan 9, 2025
Copy link
Contributor

github-actions bot commented Feb 9, 2025

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 github-actions bot added the Stale label Feb 9, 2025
@Deroswent
Copy link
Author

code 200 also hardcoded in many another routes of Cart. Examples:

packages/medusa/src/api/store/carts/[id]/line-items/route.ts

Image

packages/medusa/src/api/store/carts/[id]/shipping-methods/route.ts

Image

packages/medusa/src/api/store/carts/[id]/customer/route.ts

Image

@github-actions github-actions bot removed the Stale label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants