Skip to content

Server side rendering issue on Heroku #458

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

Closed
revskill10 opened this issue Jan 27, 2016 · 3 comments
Closed

Server side rendering issue on Heroku #458

revskill10 opened this issue Jan 27, 2016 · 3 comments

Comments

@revskill10
Copy link

I'm using Rails 4.2.5, Sprocket 3.0.0.
Locally i could prerender react component using {prerender: true} .
On Heroku, if i use prerender, there's always error:

2016-01-27T08:18:55.618746+00:00 app[web.1]: ActionView::Template::Error (undefined method `[]' for nil:NilClass):
2016-01-27T08:18:55.618747+00:00 app[web.1]:     1: <%= react_component('ChiPhiIndex', {chi_phis: @chi_phis}, {prerender: true} )%>
2016-01-27T08:18:55.618749+00:00 app[web.1]:   app/views/chi_phis/index.html.erb:1:in `_app_views_chi_phis_index_html_erb___1456543064959989113_69830504130340'

If i use {prerender: false} on Heroku, the web runs well.

How to use server side rendering on Heroku with this gem ?

@rmosolgo
Copy link
Member

Looks like the issue where some sprockets-rails versions don't have app.assets, instead they have app.manifest. Could you try this branch? #430

@revskill10
Copy link
Author

@rmosolgo The problem is, server-side rendering works fine in local, but fails in Heroku.
So what's the difference here between local and heroku ?
Anyway, i've tested the branch. And it works!

@rmosolgo
Copy link
Member

So what's the difference here between local and heroku ?

Local:

Rails.env #  => "development" 

Heroku:

Rails.env # => "production"

Rails has some ways that it behaves differently between development environment and production environment, and assets is one of those things that's different!

Thanks for giving it a try! I'll try to finish up that branch and merge it soon.

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

2 participants