mercredi 6 janvier 2016

How to debug EmberCLI failed to generate an `index.html` file?

I have a ember front-end embedded in a rails API application. I am using the ember-cli-rails 0.7 gem with the associated ember-cli-rails-addon 0.7.0 npm package. The ember app is named ui. Rails is 4.2.3. I'm deploying to a linux (Ubuntu 12.x) server.

When attempting to run my ember app on my staging server I get the following error: "EmberCLI failed to generate an index.html file."

I have setup a custom controller and view to try and isolate the problem:

app/controllers/home_controller.rb

class HomeController < ApplicationController

  def ember
    render layout: false
  end
end

config/routes.rb

mount_ember_app :ui, to: '/', controller: 'home', action: 'ember'

app/views/home/ember.html.erb

<%= render_ember_app :ui do |head| %>
  <% head.append do %>
    <%= csrf_meta_tags %>
  <% end %>
<% end %>

With the default setup and with the custom controller I get the following error. The error appears to be opaquely hidden behind the call to render_ember_app. IN other words, calling http://domain.com/beta/ results in:

I, [2016-01-06T14:51:57.249265 #26770]  INFO -- :   Rendered home/ember.html.erb (6.3ms)
I, [2016-01-06T14:51:57.249811 #26770]  INFO -- : Completed 500 Internal Server Error in 12ms (ActiveRecord: 0.0ms)
F, [2016-01-06T14:51:57.253907 #26770] FATAL -- : 
ActionView::Template::Error (          EmberCLI failed to generate an `index.html` file.
):
   1: <%= render_ember_app :ui do |head| %>
   2:   <% head.append do %>
   3:     <%= csrf_meta_tags %>
   4:   <% end %>
 app/views/home/ember.html.erb:1:in `_app_views_home_ember_html_erb__3870995094614283167_71187300'
 app/controllers/home_controller.rb:10:in `ember'

One last note if it makes a difference, the rails app is being deployed to a directory called "beta" so I've defined config.relative_url_root = '/beta' for the staging environment. The rails API is accessible correctly (e.g. http://ift.tt/1IQPi8Z works correctly).

Any ideas on what's going wrong or how to debug?




Aucun commentaire:

Enregistrer un commentaire