{"action":"created","issue":{"url":"https://api.github.com/repos/mariopeixoto/react-router-rails/issues/11","labels_url":"https://api.github.com/repos/mariopeixoto/react-router-rails/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/mariopeixoto/react-router-rails/issues/11/comments","events_url":"https://api.github.com/repos/mariopeixoto/react-router-rails/issues/11/events","html_url":"https://github.com/mariopeixoto/react-router-rails/issues/11","id":94079480,"number":11,"title":"Issue when deploying to heroku","user":{"login":"mattjstar","id":4423173,"avatar_url":"https://avatars.githubusercontent.com/u/4423173?v=3","gravatar_id":"","url":"https://api.github.com/users/mattjstar","html_url":"https://github.com/mattjstar","followers_url":"https://api.github.com/users/mattjstar/followers","following_url":"https://api.github.com/users/mattjstar/following{/other_user}","gists_url":"https://api.github.com/users/mattjstar/gists{/gist_id}","starred_url":"https://api.github.com/users/mattjstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattjstar/subscriptions","organizations_url":"https://api.github.com/users/mattjstar/orgs","repos_url":"https://api.github.com/users/mattjstar/repos","events_url":"https://api.github.com/users/mattjstar/events{/privacy}","received_events_url":"https://api.github.com/users/mattjstar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-09T15:29:24Z","updated_at":"2015-07-14T14:26:05Z","closed_at":null,"body":"After deploying to heroku I got the following error even though it works perfectly locally:\r\n\r\nActionView::Template::Error: Encountered error \"ReferenceError: PricingRoutes is not defined\" when prerendering PricingRoutes with /pricing and {}\r\n\r\nHave you seen anything similar?"},"comment":{"url":"https://api.github.com/repos/mariopeixoto/react-router-rails/issues/comments/121253143","html_url":"https://github.com/mariopeixoto/react-router-rails/issues/11#issuecomment-121253143","issue_url":"https://api.github.com/repos/mariopeixoto/react-router-rails/issues/11","id":121253143,"user":{"login":"mattjstar","id":4423173,"avatar_url":"https://avatars.githubusercontent.com/u/4423173?v=3","gravatar_id":"","url":"https://api.github.com/users/mattjstar","html_url":"https://github.com/mattjstar","followers_url":"https://api.github.com/users/mattjstar/followers","following_url":"https://api.github.com/users/mattjstar/following{/other_user}","gists_url":"https://api.github.com/users/mattjstar/gists{/gist_id}","starred_url":"https://api.github.com/users/mattjstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattjstar/subscriptions","organizations_url":"https://api.github.com/users/mattjstar/orgs","repos_url":"https://api.github.com/users/mattjstar/repos","events_url":"https://api.github.com/users/mattjstar/events{/privacy}","received_events_url":"https://api.github.com/users/mattjstar/received_events","type":"User","site_admin":false},"created_at":"2015-07-14T14:26:05Z","updated_at":"2015-07-14T14:26:05Z","body":"Yeah for sure thanks!\r\n\r\nHere's the full error on my heroku logs:\r\n```\r\napp[web.2]: source=rack-timeout id=b4366604-468b-4890-8038-f017cea18e3e wait=10ms timeout=20000ms state=ready\r\napp[web.2]: Processing by PagesController#pricing as HTML\r\napp[web.2]: source=rack-timeout id=b4366604-468b-4890-8038-f017cea18e3e wait=10ms timeout=20000ms service=99ms state=active\r\napp[web.2]:   Parameters: {\"id\"=>\"pricing\"}\r\napp[web.2]: Started GET \"/pricing\" for 108.162.219.4 at 2015-07-14 13:46:30 +0000\r\napp[web.2]:\r\napp[web.2]:     64:     section.content-section\r\napp[web.2]: ActionView::Template::Error (Encountered error \"ReferenceError: PricingRoutes is not defined\" when prerendering PricingRoutes with /pricing and {}):\r\napp[web.2]:     66:         .large-12.columns\r\napp[web.2]:   Rendered pages/pricing.html.slim within layouts/application (318.1ms)\r\napp[web.2]:     65:       .row\r\napp[web.2]:     67:           = react_router 'PricingRoutes', 'HistoryLocation', {}, { prerender_location: @page_path }\r\napp[web.2]:   app/views/pages/pricing.html.slim:67:in `_app_views_pages_pricing_html_slim__2076382808409275311_70000585619500'\r\napp[web.2]:\r\napp[web.2]:   app/controllers/pages_controller.rb:57:in `pricing'\r\napp[web.2]:\r\napp[web.2]: source=rack-timeout id=b4366604-468b-4890-8038-f017cea18e3e wait=10ms timeout=20000ms service=530ms state=completed\r\napp[web.2]: Completed 500 Internal Server Error in 330ms (ActiveRecord: 0.0ms)\r\n```\r\n\r\nWe're using [browserify-rails](https://github.com/browserify-rails/browserify-rails)\r\n\r\nHere's pricing_router.js.jsx:\r\n```js\r\nvar Route = ReactRouter.Route,\r\n    RouteHandler = ReactRouter.RouteHandler;\r\n\r\nvar PricingRouter = React.createClass({\r\n  mixins: [ReactRouter.State],\r\n\r\n  componentDidMount: function() {\r\n    // Save initial path as referrer\r\n    this.oldPath = this.getPath();\r\n  },\r\n\r\n  componentDidUpdate: function() {\r\n    // Track page views with segement.io only when route updates:\r\n    if ( this.oldPath != this.getPath() ) {\r\n      analytics.page(null, {\r\n        referrer: this.oldPath\r\n      });\r\n\r\n      this.oldPath = this.getPath();\r\n    }\r\n  },\r\n\r\n  render: function() {\r\n    return (\r\n      <div>\r\n        <WeStickyIcky>\r\n          <PricingTabs />\r\n        </WeStickyIcky>\r\n\r\n        <RouteHandler />\r\n      </div>\r\n    )}\r\n});\r\n\r\n// react-router-rails looks for this React element and\r\n// replaces the functionality of Router.run that is\r\n// normally requried for react router to work\r\nwindow.PricingRoutes = (\r\n  <Route handler={PricingRouter} ignoreScrollBehavior>\r\n    <Route name=\"pricing\" path=\"/pricing\" handler={PricingTable} />\r\n    <Route name=\"commons-starter-pricing\" path=\"/commons-starter-pricing\" handler={PricingCommonsStarter} />\r\n    <Route name=\"commons-unlimited-pricing\" path=\"/commons-unlimited-pricing\" handler={PricingCommonsUnlimited} />\r\n    <Route name=\"dedicated-desks-pricing\" path=\"/dedicated-desks-pricing\" handler={PricingDedicatedDesk} />\r\n    <Route name=\"offices-pricing\" path=\"/offices-pricing\" handler={PricingDedicatedOffice} />\r\n  </Route>\r\n);\r\n\r\nmodule.exports = PricingRouter;\r\n```\r\n\r\ncomponents.js\r\n```js\r\n//= require react_router\r\nrequire('./pricing_components');\r\n```\r\n\r\npricing_components.js\r\n```js\r\nwindow.WeStickyIcky = require('./components/we_sticky_icky');\r\nwindow.PricingTabs = require('./components/pricing/pricing_tabs');\r\nwindow.PricingRouter = require('./components/pricing_router');\r\n```\r\n\r\npricing.js.coffee\r\n```coffee\r\n############### Pricing JS ###############\r\n\r\n#= require react\r\n#= require react_ujs\r\n\r\n#= require react_router\r\n#= require react_router_ujs\r\n\r\n# Pull in our top-level components in the main javascript entry point\r\nrequire('./pricing_components');\r\n\r\n#= require_self\r\n```\r\n\r\napplication.html.slim\r\n```slim\r\nhead\r\n  = javascript_include_tag \"application\"\r\n  = javascript_include_tag \"pricing\"\r\n```\r\n\r\n\r\n\r\n\r\n"}}