javascripthtmlreactjsdockerreact-hooks

Hard dealing with Error: Minified React error #321 - ReactJS


I am building my React App and suddenly I get the following error:

Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

enter image description here

Now my APP only show that green circle button located in App.js, the rest of the website build in React shows nothing (white page).

This happened right after updating the code when I tried to upload some .mp4 videos to the server. I visited the https://reactjs.org/docs/error-decoder.html/?invariant=321 for the full message detail and check the 3 possible causes:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app

I verified each of those 3 causes, and appears to be fine.

Have you deal with something similar before? How you solved it? Do you have an idea how to debug the error?

I appreciate any help, and if you need more detail about the code or the problem, please ask.


Solution

  • After a lot of debugging, I discover that the problem was caused by certain functions of the library mdbreact

    // package.json
    
    "dependencies": {
       ...
       "mdbreact": "git+https://oauth2:YOUR_TOKEN@git.mdbootstrap.com/mdb/react/re-pro.git"
       ...
    }
    

    I have got the pro version of the library, and by default, it updates automatically. I was using the 4.27.0 version and all work just fine, then when they update the library to the new 5.0.0 versión and my app explode. It was hard to debug because only happened over production side.

    I solve this downgrading the library to 4.27.0 version just adding #4.27.0 at the end of the dependency

    // package.json
    
    "dependencies": {
       ...
       "mdbreact": "git+https://oauth2:YOUR_TOKEN@git.mdbootstrap.com/mdb/react/re-pro.git#4.27.0"
       ...
    }
    

    I'm going to keep this version until they commit a fix of these certain functions. Thanks to @tmhhao2005 who gave me guidelines to research. Hope it helps someone else with a similar error!