-
Notifications
You must be signed in to change notification settings - Fork 46.8k
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
Minified React error #[object Object] #12434
Comments
Looks odd. Can you figure out a minimal reproducing case? |
Having the same issue. Hard to debug or figure out what the error is because it only happens on the production build. In development build it works fine. Also the link it says to go to http://facebook.github.io/react/docs/error-decoder.html?invariant=[object Object] is just the generic error decoder link and doesn't offer any useful info. |
The fact that the link itself looks so weird is the bug. It doesn't offer more info because something in React itself is broken if you see this. If you can point me to a way to reproduce (even with a production website) that would be very helpful. |
One possible reason this could happen is if you're using a broken version of Uglify that breaks the React bundle. Here is an example of such issue: #12555 (comment). Try downgrading (or upgrading) Uglify. I'm going to close because we didn't get more details so far. If you can reproduce this I can take another look. |
I'm having the same issue @gaearon . I am using react-rails The expected behavior in my application is to render a wheel graph and graph key component. Clicking on a section of the graph "focuses" that section and updates the forst key in the key component. What happens instead is after clicking on the section I receive the error "Error: Minified React error #[object Object]" and my key component ends up with 3 elements instead of 2. I console logged my keys all the way through the onClick listener to rendering the key component again and the "keys" prop only ever show an array of 2 items. It's like the component is adding the new props instead of replacing them. This issue only occurs for me in production and not on my local. I tried tracking the error down best I could in the minified src and this is what I got. |
Thanks for extra info, this helps. Can I ask you to take a screenshot like this for every call stack frame? I'm sorry if this is annoying. i.e. click on Call Stack in the debugger and screenshot where that argument ( |
Also we'd need to know which version of React you're using |
What version of React itself does you version of |
The second frame is the most interesting: The When I look at actual React code published on npm (for example, React 16.3.1 production CommonJS bundle), this piece of code looks like: function df(a, b, c, d, e) {
function f(a) { // <-------------- definition of f()
var c = a.ref;
if (null !== c)
if ("function" === typeof c)
try {
c(null);
} catch (t) {
b(a, t);
}
else c.current = null;
}
function h(a) {
"function" === typeof Je && Je(a);
switch (a.tag) {
case 2:
f(a);
var c = a.stateNode;
if ("function" === typeof c.componentWillUnmount)
try {
(c.props = a.memoizedProps),
(c.state = a.memoizedState),
c.componentWillUnmount();
} catch (t) {
b(a, t);
}
break;
case 5:
f(a); // <-------------------- call that crashes for you
break;
case 7:
g(a.stateNode);
break;
case 4:
p && v(a);
}
} So in the original code, we're calling a function defined right above. But in your bundle, we're calling a completely different function (that prints an invariant). I'd appreciate if you could paste a larger chunk of your bundle around the second call frame I mentioned above. Maybe it could help illuminate what happened to the actual function we wanted to call. Overall, my guess is this is a bug in Uglify (or whatever React Rails is using for minification). But we'll need a reproducing project to confirm it. At the very least we need to know which versions of Webpack and Uglify you're using. |
Here are a couple blocks above and the rest of the block that contains the function call in frame 2.
React version: 16.2.0 |
Can you find a list of Uglify options you're using? |
Also, do you know if it uses UMD or CommonJS build of ReactDOM? |
We don't have any custom options set, so it's just the default listed here => https://github.com/lautis/uglifier I'm not sure about UMD vs. CommonJS. I can try to find out. |
Which version of |
Uglifier is version (2.5.3). |
@gaearon Heads up, I removed uglifier and pushed to a test environment and it works now. Obviously, I can't push to production like that, but at least I can see that uglifier is indeed the issue. |
It's fixed! 🎉 I replaced |
Building locally produces no errors, whereas our production build serves the following:
I am unsure how to debug this, as there does not seem to be precedent for receiving an error code that is an object. Any ideas on how to proceed?
The text was updated successfully, but these errors were encountered: