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

"ReferenceError: clearTimeout is not defined on Heroku #449

Closed
ramusus opened this issue Jun 11, 2016 · 11 comments
Closed

"ReferenceError: clearTimeout is not defined on Heroku #449

ramusus opened this issue Jun 11, 2016 · 11 comments

Comments

@ramusus
Copy link

ramusus commented Jun 11, 2016

Hi, guys!

Few hours ago after another deploy to Heroku with no essential changes I got error:

ERROR when compiling base_js_code! See file tmp/base_js_code.js to correlate line numbers of error. Error is
2016-06-11T00:19:30.146600+00:00 app[web.1]:
2016-06-11T00:19:30.146601+00:00 app[web.1]: ReferenceError: clearTimeout is not defined

Full stack here http://pastebin.com/LYgpRxZa

I tried to find base_js_code.js, but there is no such file in tmp. If I turn off prerender feature everything is deploying and working on heroku as it was just one day ago. I compared versions of gems and npm packages - no any visible differences between successful and not successful deploys. I searched for clearTimeout string - no any occurrences in my project only in node_modules directory. The problem is this error happens only on Heroku servers. Locally everything is working with pretender as well as without. But If I put clearTimeout call into any of my react component - I got the same error locally.

May be there is a way to define this bloody clearTimeout only for server prerender environment?

Completely stacked..

Any ideas what to do?

@justin808
Copy link
Member

@martyphee is also seeing this. This will take some investigative work.

If this is during server rendering, we should polyfill this, as we do here:

These methods are polyfilled for server rendering to be no-ops. We don't log calls to these by default as some libraries, namely babel-polyfill, will call setTimout. If you wish to log calls to setTimeout and setInterval, set the ENV value: `export TRACE_REACT_ON_RAILS=YES`.

https://medium.com/@railsonmaui/homeway-and-introducing-friends-and-guests-d4d365c6ad8d#.v8ttay83d

If this is during deployment and asset compilation, I really don't know.

@martyphee @ramusus Please let us know what you find and if you have a fix, please submit a PR.

@martyphee
Copy link
Contributor

This is happening only after deployment. I wasn't able to reproduce it locally. Only on the server.

@xiaopow
Copy link

xiaopow commented Jun 11, 2016

Hey guys, seeing the same thing since yesterday. No changes in npm and gem packages.

2016-06-11T09:12:23.479339+00:00 app[web.1]: ERROR when compiling base_js_code! See file tmp/base_js_code.js to correlate line numbers of error. Error is
2016-06-11T09:12:23.479360+00:00 app[web.1]: ReferenceError: clearTimeout is not defined
2016-06-11T09:12:23.479361+00:00 app[web.1]: 
2016-06-11T09:12:23.479361+00:00 app[web.1]: Object.<anonymous> ((execjs):8015:27)
2016-06-11T09:12:23.479362+00:00 app[web.1]: __webpack_require__ ((execjs):51:30)
2016-06-11T09:12:23.479363+00:00 app[web.1]: Object.<anonymous> ((execjs):8003:78)
2016-06-11T09:12:23.479364+00:00 app[web.1]: __webpack_require__ ((execjs):51:30)
2016-06-11T09:12:23.479364+00:00 app[web.1]: Object.<anonymous> ((execjs):92:2)
2016-06-11T09:12:23.479366+00:00 app[web.1]: __webpack_require__ ((execjs):51:30)
2016-06-11T09:12:23.479367+00:00 app[web.1]: __webpack_require__ ((execjs):51:30)
2016-06-11T09:12:23.479368+00:00 app[web.1]: (execjs):71:18

@martyphee
Copy link
Contributor

martyphee commented Jun 11, 2016

I'd really like to find out what caused this. We can't have this happening since we deploy 10-20 times a day to production. Something minor had to be changed.

I think I just duplicated it locally!!!!

image

@martyphee
Copy link
Contributor

martyphee commented Jun 11, 2016

It's some shim. Need to find where it's coming from. process/browser.js. @justin808 bable-pollyfill. 296 is the webpack number.

    __webpack_require__(296);

    /* eslint max-len: 0 */

    if (global._babelPolyfill) {
      throw new Error("only one instance of babel-polyfill is allowed");
    }

image

@justin808
Copy link
Member

We just need to polyfill to it probably.

@Tamiyadd
Copy link

Hi guys, i'm having the same problem and i found that is due by process npm package

Here the issue
defunctzombie/node-process#60

reverting back to 0.11.3 version worked well.

@ramusus
Copy link
Author

ramusus commented Jun 14, 2016

Confirmed, after I put [email protected] into package.json, deploy to Heroku with prerender enabled started to be successful.

@Tamiyadd
Copy link

A little update,
process developers released an update that fix the bug. Also version 6.0.4 of react on rails works too

@ramusus
Copy link
Author

ramusus commented Jun 14, 2016

Great! Closing this issue! Thanks for quick support!

@ramusus ramusus closed this as completed Jun 14, 2016
@h8rry
Copy link

h8rry commented Jun 14, 2016

Works for us too. Thanks!
On Tue, Jun 14, 2016 at 7:49 PM Boris Shifrin [email protected]
wrote:

Great! Closing this issue! Thanks for quick support!


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#449 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABnmZHbxboCH-qiG2leznJZCIHAQJvUwks5qLpU_gaJpZM4Izbez
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants