We've moved discussions to Discord

Missing template error when deploying to production

Benjamin Houy
Hi,

I'm trying to deploy to production on Hatchbox and keep getting a missing template error. I also tried locally with RAILS_ENV=production bin/dev and get the same error. 

Any idea how to fix it? 

Thanks
^Mweb    | Error during failsafe response: Missing template errors/not_found, application/not_found with {:locale=>[:en], :formats=>[:css], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder]}. Searched in:
web    |   * "/Users/bhouy/environment/french_together/app/views"
web    |   * "/Users/bhouy/environment/french_together/lib/jumpstart/app/views"
web    |   * "/Users/bhouy/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/pay-3.0.24/app/views"
web    |   * "/Users/bhouy/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/devise-i18n-1.10.1/app/views"
web    |   * "/Users/bhouy/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/devise-4.8.0/app/views"
web    |   * "/Users/bhouy/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/administrate-field-active_storage-0.3.7/app/views"
web    |   * "/Users/bhouy/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/administrate-b0f2ae27fd7c/app/views"
web    |   * "/Users/bhouy/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/kaminari-core-1.2.1/app/views"
web    |   * "/Users/bhouy/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/actiontext-6.1.4.1/app/views"
web    |   * "/Users/bhouy/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/actionmailbox-6.1.4.1/app/views"
Benjamin Houy
I haven't fixed the issue but I noticed that the app works if I set config.assets.compile to true in production. 
Chris Oliver
You have implemented something that is trying to render the not_found template it looks like. There's nothing in Jumpstart Pro that renders a template with that name.
Matt Webb
Hi all! I'm getting this exact same error - I've made no changes to the Rails application itself, just generated the `jumpstart.yml` and now I'm trying to run the "production" fullstaq image with Docker Compose. When visiting the index page from the browser, I receive the following:
Error during failsafe response: Missing template errors/not_found, application/not_found with {:locale=>[:en], :formats=>[:css], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder]}.

Looking at the browser request log, the following request is failing with a 500:
https://<my application url>/assets/application-0f75b1427db5c98cc646d458471c22307a931871d52d3ad2eda06dfc357bacfb.css

My guess is that this is the result of my adding the following precompile step to my Dockerfile:
RUN rm -rf public/assets public/packs public/packs-test \ 
    && bundle exec rake assets:clean assets:precompile

Does anyone have any idea why exactly the precompiled assets are causing the server to 500? Thanks!
Matt Webb
Figured it out! Looks like by default, the production and staging environments are configured not to serve static assets. This can be toggled by setting the env variable RAILS_SERVE_STATIC_FILES to true
Notifications
You’re not receiving notifications from this thread.