medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
26.14k stars 2.64k forks source link

[Bug]: Error: Undefined is not an object (evaluating ‘n.inventory.map’) during Product Creation #9983

Open YoungCR opened 2 weeks ago

YoungCR commented 2 weeks ago

Package.json file

{
  "name": "medusa-2.0-boilerplate-backend",
  "version": "0.0.2",
  "description": "A Prebaked Medusa 2.0 backend",
  "author": "Rasmus Puls",
  "license": "MIT",
  "keywords": [
    "sqlite",
    "postgres",
    "typescript",
    "ecommerce",
    "headless",
    "medusa"
  ],
  "scripts": {
    "build": "medusa build && node src/scripts/postBuild.js",
    "seed": "medusa exec ./src/scripts/seed.ts",
    "start": "init-backend && cd .medusa/server && medusa start --verbose",
    "dev": "medusa develop",
    "email:dev": "email dev --dir=./src/modules/email-notifications/templates --port=3002"
  },
  "dependencies": {
    "@medusajs/admin-sdk": "latest",
    "@medusajs/cli": "latest",
    "@medusajs/core-flows": "^2.0.1",
    "@medusajs/framework": "latest",
    "@medusajs/medusa": "latest",
    "@medusajs/notification-sendgrid": "latest",
    "@medusajs/payment-stripe": "latest",
    "@medusajs/types": "^2.0.1",
    "@medusajs/utils": "^2.0.1",
    "@medusajs/workflow-engine-redis": "^2.0.1",
    "@mikro-orm/core": "5.9.7",
    "@mikro-orm/knex": "5.9.7",
    "@mikro-orm/migrations": "5.9.7",
    "@mikro-orm/postgresql": "5.9.7",
    "@react-email/components": "^0.0.26",
    "awilix": "^8.0.1",
    "express": "^4.21.1",
    "medusajs-launch-utils": "^0.0.5",
    "pg": "^8.13.0",
    "resend": "4.0.1-alpha.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",
    "react-email": "^3.0.2",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",
    "vite": "^5.2.11"
  },
  "packageManager": "pnpm@9.10.0",
  "engines": {
    "node": "22.x",
    "npm": "10.x"
  }
}

Node.js version

v22 via Railway

Database and its version

PostgreSQL Latest via Railway

Operating system name and version

iPadOS 17.7.1

Browser name

Safari

What happended?

I’m attempting to setup a store that has different variations of the same product. During a manual product creation I have all the required fields filled out but get an error when trying to save as shown in the screen shot below. I have had this error with a local development instance as well before.

IMG_0261

Expected behavior

Save product and variants as a draft or publish

Actual behavior

Upon clicking “save as draft” or “publish” the following error is produced and will not let anything be saved: Error: Undefined is not an object (evaluating ‘n.inventory.map’)

Link to reproduction repo

https://github.com/YoungCR/medusajs-2.0-for-railway-boilerplate

sgirones commented 2 weeks ago

hey YoungCR, any chance you can check the developer console and see if there's more information about the error printed there?