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]: Server Error on Batch Update/Delete Operations #10828

Open
rkmcdonnell opened this issue Jan 5, 2025 · 1 comment
Open

[Bug]: Server Error on Batch Update/Delete Operations #10828

rkmcdonnell opened this issue Jan 5, 2025 · 1 comment

Comments

@rkmcdonnell
Copy link

rkmcdonnell commented Jan 5, 2025

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",
    "predeploy": "medusa db:migrate"
  },
  "dependencies": {
    "@medusajs/admin-sdk": "^2.1.3",
    "@medusajs/cli": "^2.1.3",
    "@medusajs/framework": "^2.1.3",
    "@medusajs/medusa": "^2.1.3",
    "@mikro-orm/core": "5.9.7",
    "@mikro-orm/knex": "5.9.7",
    "@mikro-orm/migrations": "5.9.7",
    "@mikro-orm/postgresql": "5.9.7",
    "awilix": "^8.0.1",
    "medusa-payment-stripe": "^6.0.11",
    "pg": "^8.13.0"
  },
  "devDependencies": {
    "@medusajs/test-utils": "^2.1.3",
    "@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

v20.14.0

Database and its version

PostgreSQL 16.4

Operating system name and version

Debian 12.2.0-14

Browser name

No response

What happended?

I'm attempting to use the "Manage Products" Admin API endpoint ("/admin/products/batch"). The "delete" and "update" operations are causing a 500 server error. My backend logs just say "Cannot read properties of undefined (reading 'map')". Oddly, I have no issues with the "create" operation on this endpoint. For reference, here are the test payloads I used for the "delete" and "update" operations, respectively.

{
    "delete": ["prod_01JGVXHF4F8MM5VPKYM158NY1F"]
}
{
    "update": [
        {
            "id": "prod_01JBZ5RR6F2VNN1A5R6B56D588",
            "title": "Medusa Coffee Mug"
        },
        {
            "id": "prod_01JGSPVMM4MBMD87ZW0MX6T7P5",
            "title": "Medusa Sweatpants"
        }
    ]
}

Expected behavior

Expecting a 200 response with successful batch product modifications.

Actual behavior

Received a 500 response with no information about the issue (see above).

@carlos-r-l-rodrigues
Copy link
Contributor

Hi @rkmcdonnell,
could you please paste the stack trace of the error so we can identify from where it is coming from?

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

2 participants