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]: Invalid BigNumber value: null. Should be one of: string, number, BigNumber (bignumber.js), BigNumberRawValue #10918

Closed
imash96 opened this issue Jan 11, 2025 · 1 comment

Comments

@imash96
Copy link

imash96 commented Jan 11, 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": {
    "predeploy": "medusa db:migrate",
    "build": "medusa build",
    "seed": "medusa exec ./src/scripts/main.ts",
    "start": "medusa start",
    "dev": "medusa develop",
    "user": "medusa user --email '[email protected]' --password #SuperSecret@7061",
    "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",
    "awilix": "^8.0.1",
    "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

v20.18.1

Database and its version

PostgreSQL 17.2

Operating system name and version

Windows 11

Browser name

No response

What happended?

I am currently developing the frontend for my e-commerce platform. While testing the discount component, I created a coupon code through the admin dashboard and successfully applied it on the frontend. However, when I attempted to decrement the quantity of an item while the discount code is applied from the cart, an error occurred but if it try to remove the item there is no error.

Expected behavior

The item should have remove from the cart and then all the amount get adjusted accordingly.

Actual behavior

below error was thown in backend console.

http: POST /store/carts/cart_01JH31JR1GB4RP09DNPAZGYW5P/line-items/cali_01JH362WQV95FKF05FB8KHHXFH ← - (200) - 2476.881 ms
http: GET /store/carts/cart_01JH31JR1GB4RP09DNPAZGYW5P?fields=%2Aitems%2C%20%2Aregion%2C%20%2Aitems.product%2C%20%2Aitems.variant%2C%20%2Aitems.thumbnail%2C%20%2Aitems.metadata%2C%20%2Bitems.total%2C%20%2Apromotions ← - (200) - 34.648 ms
error: Cannot read properties of undefined (reading 'actor_id')
TypeError: Cannot read properties of undefined (reading 'actor_id')
at GET (D:\Project\backend\src\api\store\customers\i\route.ts:8:33)
at D:\Project\backend\node_modules@medusajs\utils\src\common\wrap-handler.ts:17:20
at Layer.handle [as handle_request] (D:\Project\backend\node_modules\express\lib\router\layer.js:95:5)
at next (D:\Project\backend\node_modules\express\lib\router\route.js:149:13)
at Route.dispatch (D:\Project\backend\node_modules\express\lib\router\route.js:119:3)
at Layer.handle [as handle_request] (D:\Project\backend\node_modules\express\lib\router\layer.js:95:5)
at D:\Project\backend\node_modules\express\lib\router\index.js:284:15
at Function.process_params (D:\Project\backend\node_modules\express\lib\router\index.js:346:12)
at next (D:\Project\backend\node_modules\express\lib\router\index.js:280:10)
at next (D:\Project\backend\node_modules\express\lib\router\route.js:141:14)

second try to decrement quantity of item from cart

error: Invalid BigNumber value: null. Should be one of: string, number, BigNumber (bignumber.js), BigNumberRawValue
{
message: 'Invalid BigNumber value: null. Should be one of: string, number, BigNumber (bignumber.js), BigNumberRawValue',
name: 'Error',
stack: 'Error: Invalid BigNumber value: null. Should be one of: string, number, BigNumber (bignumber.js), BigNumberRawValue\n' +
' at BigNumber.setRawValueOrThrow (D:\Project\backend\node_modules\@medusajs\utils\src\totals\big-number.ts:76:13)\n' +
' at new BigNumber (D:\Project\backend\node_modules\@medusajs\utils\src\totals\big-number.ts:16:10)\n' +
' at MikroORMEntity.set [as amount] (D:\Project\backend\node_modules\@medusajs\utils\src\dal\mikro-orm\big-number-field.ts:42:25)\n' +
' at eval (eval at createFunction (D:\Project\backend\node_modules\@mikro-orm\core\utils\Utils.js:833:20), :9:57)\n' +
' at Function.callCompiledFunction (D:\Project\backend\node_modules\@mikro-orm\core\utils\Utils.js:844:20)\n' +
' at ObjectHydrator.hydrate (D:\Project\backend\node_modules\@mikro-orm\core\hydration\ObjectHydrator.js:27:23)\n' +
' at EntityFactory.hydrate (D:\Project\backend\node_modules\@mikro-orm\core\entity\EntityFactory.js:203:27)\n' +
' at EntityFactory.create (D:\Project\backend\node_modules\@mikro-orm\core\entity\EntityFactory.js:56:18)\n' +
' at SqlEntityManager.create (D:\Project\backend\node_modules\@mikro-orm\core\EntityManager.js:980:41)\n' +
' at D:\Project\backend\node_modules\@medusajs\utils\src\dal\mikro-orm\mikro-orm-repository.ts:353:24\n' +
'⮑ sat D:\Project\backend\node_modules\@medusajs\core-flows\dist\cart\workflows\update-cart-promotions.js: [update-cart-promotions -> create-line-item-adjustments (invoke)]\n' +
'⮑ sat D:\Project\backend\node_modules\@medusajs\core-flows\dist\cart\workflows\refresh-cart-items.js: [refresh-cart-items -> update-cart-promotions-as-step (invoke)]\n' +
'⮑ sat D:\Project\backend\node_modules\@medusajs\core-flows\dist\cart\workflows\update-line-item-in-cart.js: [update-line-item-in-cart -> refresh-cart-items-as-step (invoke)]'
}
info: Processing LinkCartPromotion.attached which has 0 subscribers
http: POST /store/carts/cart_01JH31JR1GB4RP09DNPAZGYW5P/line-items/cali_01JH362WQV95FKF05FB8KHHXFH ← - (500) - 2208.933 ms

Link to reproduction repo

NA

@thetutlage
Copy link
Contributor

Hello @imash96

A reproduction repo will be needed before we can debug this issue. For now, I will close the issue. However, feel free to reply with a link to the reproduction repo

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