Production code failing, dev code totally fine

Has anyone else run into this issue where your app works perfectly in dev, and when you deploy it to Galaxy (or just run meteor run --production), errors are thrown? It’s extremely frustrating. I’m in the middle of trying to pinpoint the problem, but in the mean time, I’m wondering why this happens, and what we can do to reduce how much we have to “double QA” our apps?

There are a multitude of reasons why this could happen. Experienced this recently when the module redux-react-form stopped yielding the form’s content upon submit.

But only in production, development worked fine.

Turned out that Material-UI which I was using to build the view for the form simply dropped a data tag on its components in production. But redux-react-form depended on that data tag to be existant.

And presto! Working in development, broken in production.

Then again, this issue was even more of a mystery as things simply stopped working - no errors, no exceptions, nothing.

And here’s the nice part: Not much you can do to prevent it other than run your app locally in production before deploying it.

1 Like

Ugh, it was indeed react-redux-form. It has to do with the custom field class not being able to determine the name of the component it’s wrapping. The workaround is to make sure your component explicitly sets a displayName. So in my case:

          <MUITextField model="attachmentModel.content">

I simply had to add MarkdownTextArea.displayName = "MarkdownTextArea"; to make it work in production. The bigger question is, though, why does this work in dev but not production? What piece of information about React components exists in dev that goes away in prod?

Yep. I participated in that thread. :slight_smile: