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]: updateProductOptionValues raises 'Cannot read properties of undefined (reading 'saveRawMessageData')' #11709

Open
freakspace opened this issue Mar 4, 2025 · 3 comments

Comments

@freakspace
Copy link

Package.json file

{
  "name": "",
  "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.5.1",
    "@medusajs/cli": "2.5.1",
    "@medusajs/framework": "2.5.1",
    "@medusajs/medusa": "2.5.1",
    "@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",
    "multer": "^1.4.5-lts.1",
    "pg": "^8.13.0",
    "prettier": "^3.3.3"
  },
  "devDependencies": {
    "@medusajs/test-utils": "latest",
    "@mikro-orm/cli": "6.4.3",
    "@swc/core": "1.5.7",
    "@swc/jest": "^0.2.36",
    "@types/jest": "^29.5.13",
    "@types/multer": "^1.4.12",
    "@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"
  },
  "optionalDependencies": {
    "@rollup/rollup-linux-x64-musl": "*"
  },
  "engines": {
    "node": ">=20"
  }
}

Node.js version

v21.6.1

Database and its version

PostgresSQL 15

Operating system name and version

Windows 11

Browser name

No response

What happended?

The method updateProductOptionValues raises error TypeError: Cannot read properties of undefined (reading 'saveRawMessageData')

const option = await productModuleService.updateProductOptionValues( optionValueId, { metadata: { image: medias, }, } );

Expected behavior

ProductOptionValueDTO should be returned

Actual behavior

The optionValue is updated, but this error is raised:

TypeError: Cannot read properties of undefined (reading 'saveRawMessageData')

Link to reproduction repo

Sorry don't have

@opeah
Copy link

opeah commented Mar 4, 2025

Still occurring in 2.6.0

@thetutlage
Copy link
Contributor

Can you share the issue of medias? Because the following code works for me

await req.scope
    .resolve("product")
    .updateProductOptionValues("optval_01JNJY9WZ4J070VVY1V1RH80GR", {
      metadata: { images: [{ id: 1 }] },
    });

@freakspace
Copy link
Author

medias

[ { file_id: '1741312033851-Photoroom-20250304_090003.png', mime_type: 'image/png', url: 'http://localhost:9000/static/1741312033851-Photoroom-20250304_090003.png' } ]

I've also tried this

await req.scope .resolve("product") .updateProductOptionValues("optval_01JNJY9WZ4J070VVY1V1RH80GR", { metadata: { images: [{ id: 1 }] }, });

Which returns same error

Updated to 2.6.0 and still occurs

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