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

Cannot read properties of undefined (reading '0') #8477

Open
KareemAbbas1 opened this issue Aug 6, 2024 · 12 comments
Open

Cannot read properties of undefined (reading '0') #8477

KareemAbbas1 opened this issue Aug 6, 2024 · 12 comments

Comments

@KareemAbbas1
Copy link

KareemAbbas1 commented Aug 6, 2024

Bug report

Describe the bug

I've installed Medusa backend and admin dashboard and everything is working fine until I try to mark an order as shipped I get the following error

System information

Medusa version (including plugins): 1.20.6
Node.js version: 18.18.0
Database: Postgres
Operating system: Windows
Browser (if relevant): Chrome

Steps to reproduce the behavior

  1. The general steps for initial project setup.
  2. Follow the onboarding and create a sample order or create an order from a draft.
  3. Create a region and create with manual fulfillment, manual payment, and create a shipping option for that region.
  4. Navigate to the new order, create fulfillment, and then mark order as shipped.

Expected behavior

Mark the order as shipped.

Screenshots

Screenshot 2024-08-06 231422

Code snippets

React Router caught the following error during render
TypeError: Cannot read properties of undefined (reading '0')
at index.tsx:59:21
at Array.map ()
at j (index.tsx:57:34)
at le (react-dom.development.js:15486:18)
at cB (react-dom.development.js:19617:20)
at c9 (react-dom.development.js:21640:16)
at eh (react-dom.development.js:27465:14)
at fq (react-dom.development.js:26596:12)
at react-dom.development.js:26505:5
at fF (react-dom.development.js:26507:1)

{componentStack: '\n at j (http://localhost:7001/node_modules_mome… g (http://localhost:7001/main.bundle.js:679:855)'}'%7D)

at q (http://localhost:7001/main.bundle.js:27:6566)
at ec (http://localhost:7001/main.bundle.js:27:13037)
at R (http://localhost:7001/node_modules_moment_locale_sync_recursive_-_cache_admin_src_pages_a_tsx.chunk.js:931:5767)
at U (http://localhost:7001/main.bundle.js:27:7148)
at q (http://localhost:7001/main.bundle.js:27:6566)
at ec (http://localhost:7001/main.bundle.js:27:13037)
at main
at div
at div
at div
at u (http://localhost:7001/_cache_admin_src_components_templates_layout_tsx.chunk.js:95:572)
at http://localhost:7001/vendors-node_modules_iso8601-duration_lib_index_js-node_modules_lodash_mapKeys_js-node_module-9be8ac.chunk.js:1632:340
at A (http://localhost:7001/node_modules_moment_locale_sync_recursive_-_cache_admin_src_pages_a_tsx.chunk.js:1223:2098)
at m (http://localhost:7001/node_modules_moment_locale_sync_recursive_-_cache_admin_src_pages_a_tsx.chunk.js:489:602)
at $ (http://localhost:7001/node_modules_moment_locale_sync_recursive_-_cache_admin_src_pages_a_tsx.chunk.js:1223:1530)
at w (http://localhost:7001/main.bundle.js:669:1036)
at U (http://localhost:7001/main.bundle.js:27:7148)
at q (http://localhost:7001/main.bundle.js:27:6566)
at ec (http://localhost:7001/main.bundle.js:27:13037)
at el (http://localhost:7001/main.bundle.js:27:12139)
at eo (http://localhost:7001/main.bundle.js:27:10263)
at Suspense
at P
at p (http://localhost:7001/main.bundle.js:683:748)
at p (http://localhost:7001/main.bundle.js:681:738)
at p (http://localhost:7001/main.bundle.js:685:743)
at S (http://localhost:7001/main.bundle.js:641:2689)
at x (http://localhost:7001/main.bundle.js:643:2490)
at m (http://localhost:7001/main.bundle.js:673:785)
at v (http://localhost:7001/main.bundle.js:677:1185)
at v (http://localhost:7001/main.bundle.js:671:1710)
at t.QueryClientProvider (http://localhost:7001/main.bundle.js:307:709)
at g (http://localhost:7001/main.bundle.js:467:11805)
at c (http://localhost:7001/main.bundle.js:675:579)
at t (http://localhost:7001/main.bundle.js:535:6890)
at g (http://localhost:7001/main.bundle.js:679:855)

@shahednasser @sidcool1234 @Arsenalist @madsleejensen @l4u

@liho00
Copy link

liho00 commented Aug 11, 2024

yup same issue here

@sarthak3154
Copy link

+1, same issue

@jukkasuorsa
Copy link

Having same issue. There was another ticket about this issue earlier #7832

@Hermitauge
Copy link

same, installed brand new 1.20.9, can't mark order as shipped, please fix this

@Hermitauge
Copy link

anyone found a solution?

@lrocher91
Copy link

As the error only shows up in development environment (medusa develop), i develop with the medusa start command (and restart / rebuild on each changes).

@Hermitauge
Copy link

any possible solution to this please?

@KareemAbbas1
Copy link
Author

Hello everyone,

Unfortunately, I haven't found a solution to this problem yet. I've been swamped at work and haven't had the time to debug the issue thoroughly. From what I can gather, the problem seems to have started after I added a new region with a fake shipping profile. I made the first demo order using this new region and shipping profile, and when I tried to mark that order as shipped, the issue arose. The problem persisted with subsequent orders from the default region (e.g., NA) using the default fake shipping profile.

Ultimately, I reinstalled Medusa.js, placed the first demo order from one of the default regions using the default fake shipping profile, and marked it as shipped, which worked. Afterward, I added my custom region and fake shipping profile again, and everything worked as expected.

I hope to have time later to dive deeper into debugging this problem or at least understand why it occurs.

@michsko544
Copy link

I can confirm that the error is not showing when using medusa build and medusa start
Medusa Version: 1.20.9

@n4bb12
Copy link

n4bb12 commented Sep 2, 2024

As a bandaid, you can make a change to this line:

-...watchedFields[index], 
+...watchedFields?.[index], 

in your node_modules and use https://www.npmjs.com/package/patch-package to make it persistent.

@SalahAdDin
Copy link

As a bandaid, you can make a change to this line:

-...watchedFields[index], 
+...watchedFields?.[index], 

in your node_modules and use https://www.npmjs.com/package/patch-package to make it persistent.

What do you think about a PR?

@olivermrbl
Copy link
Contributor

This should be solved in the latest release of the dashboard. Can you install @medusajs/[email protected] and try again please?

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

10 participants