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

Deploying to Heroku fails #80

Closed
johnmcdowall opened this issue Feb 10, 2015 · 30 comments
Closed

Deploying to Heroku fails #80

johnmcdowall opened this issue Feb 10, 2015 · 30 comments

Comments

@johnmcdowall
Copy link

Rails: 4.0.2

Package.json:

{
  "name": "new-admin",
  "version": "0.0.1",
  "description": "snip",
  "private": true,
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "scripts": {
    "start": "ember server",
    "build": "ember build",
    "postinstall": "../../node_modules/bower/bin/bower install",
    "test": "ember test"
  },
  "repository": "",
  "engines": {
    "node": ">= 0.10.0"
  },
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "broccoli-asset-rev": "^2.0.0",
    "broccoli-coffee": "^0.4.0",
    "broccoli-ember-hbs-template-compiler": "^1.6.1",
    "broccoli-sass": "git://github.com/spiceworks/broccoli-sass",
    "ember-cli": "0.1.11",
    "ember-cli-6to5": "^3.0.0",
    "ember-cli-app-version": "0.3.0",
    "ember-cli-coffeescript": "0.8.0",
    "ember-cli-content-security-policy": "0.3.0",
    "ember-cli-dependency-checker": "0.0.7",
    "ember-cli-ic-ajax": "0.1.1",
    "ember-cli-inject-live-reload": "^1.3.0",
    "ember-cli-jquery-ui": "0.0.13",
    "ember-cli-qunit": "0.3.0",
    "ember-cli-rails-addon": "0.0.11",
    "ember-cli-uglify": "1.0.1",
    "ember-data": "1.0.0-beta.12",
    "ember-export-application-global": "^1.0.0",
    "express": "^4.8.5",
    "glob": "^4.0.5"
  }
}

Everything works locally during development, but deploying to Heroku fails with:

rake aborted!
       NoMethodError: undefined method `directory?' for nil:NilClass
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:307:in `block in each_entry'
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:303:in `each'
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:303:in `each_entry'
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:322:in `block in each_file'
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:321:in `each'
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:321:in `each_file'
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:335:in `each_logical_path'
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:115:in `each'
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:115:in `to_a'
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:115:in `compile'
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/rake/sprocketstask.rb:146:in `with_logger'
       /tmp/build_3b713c089beab5cd5652456593dc27bb/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
       Tasks: TOP => assets:precompile
       (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !

 !     Push rejected, failed to compile Multipack app

I am building the Ember applications styles from the ember-cli styles directory using SASS.

Any ideas?

@johnmcdowall
Copy link
Author

Took a cue from the stack trace including manifest.rb, and included this in my Brocfile.js:

var app = new EmberApp({
  fingerprint: {
    generateRailsManifest: true
  }
});

But no dice :(

@johnmcdowall
Copy link
Author

I should note, I am deploying to a staging Heroku environment. So I tried to ensure that the asset-rev always runs with this:

var app = new EmberApp({
  fingerprint: {
    enabled: true,
    generateRailsManifest: true
  }
});

But still nothing.

@rwz
Copy link
Collaborator

rwz commented Feb 10, 2015

First off, Ember fingerprinting and generateRailsManifest SHOULD both be disabled. Second, what version of the EmberCLI Rails are you using? Third, is there a reason you're using the version of Rails that was released more than a year ago and received eleven bugfix releases since then?

@rwz
Copy link
Collaborator

rwz commented Feb 10, 2015

Assuming you're using the latest version of ember-cli-rails, is there a chance you could build a minimal showcase app to demonstrate the error?

@rwz
Copy link
Collaborator

rwz commented Feb 10, 2015

Also, what happens when you run RAILS_ENV=production rake assets:precompile locally?

@johnmcdowall
Copy link
Author

Where is it documented that 'Ember fingerprinting and generateRailsManifest SHOULD both be disabled.'? This seems to be a vital piece of information and there's nothing covering it.

I'm using Ember-CLI 0.1.12.

Yes, there's a very good reason. I have no control over it. Unfortunately I don't live in a magical greenfield consulting land where I can enjoy everything new, all the time.

@rwz
Copy link
Collaborator

rwz commented Feb 10, 2015

Unfortunately I don't live in a magical greenfield consulting land where I can enjoy everything new, all the time.

😿

Cheer up, there's nothing that should be preventing the gem from working properly on Rails 4.0.2. It's a bug and we'll try to fix it, so it's gonna be all good.

@rwz
Copy link
Collaborator

rwz commented Feb 10, 2015

Where is it documented that 'Ember fingerprinting and generateRailsManifest SHOULD both be disabled.'? This seems to be a vital piece of information and there's nothing covering it.

Rails manifest is disabled by default and our magical addon takes care of disabling the fingerprinting.

The idea behind the gem was that the integration should be as seamless as possible and the whole experience should be very Rails-like. The assumption is that it should work with default settings, which it kind of does. If you're messing with deployment-related options, you must be knowing what you're doing better than we do.

@johnmcdowall
Copy link
Author

Ultimately it was nothing to do with Sprockets.

Because of this nonsense (https://github.com/rwz/ember-cli-rails/blob/master/lib/ember-cli/app.rb#L18) an exception that was being thrown by Ember-CLI was being completely swallowed when deploying on Heroku.

Don't swallow output, please.

@tigershen23
Copy link

@johnmcdowall Getting this same error - would you mind sharing how you resolved it?

@gordonbisnor
Copy link

I'm getting this as well, Rails 4.1.9, ember-cli-rails 0.1.11, ember-cli 0.2.0 –– would be curious to hear how you fixed or debugged.

@thewatts
Copy link
Contributor

I think there is a solution on #112 --> but I haven't had a chance to validate yet.

Nathaniel Watts

On Sat, Mar 14, 2015 at 5:41 PM, Gordon B. Isnor notifications@github.com
wrote:

I'm getting this as well, Rails 4.1.9, ember-cli-rails 0.1.11, ember-cli 0.2.0 –– would be curious to hear how you fixed or debugged.

Reply to this email directly or view it on GitHub:
#80 (comment)

@johnmcdowall
Copy link
Author

For me, there was an exception being thrown elsewhere because of a missing asset file, that at the time was being swallowed by ember-cli-rails:

#82

@tigershen23
Copy link

@johnmcdowall how were you eventually able to track that down?

@rwz
Copy link
Collaborator

rwz commented Mar 15, 2015

This issue was fixed in 0.1.0 in this commit 2b4637b. Build errors raise an error now.

@rwz
Copy link
Collaborator

rwz commented Mar 15, 2015

@tigershen23 you could track down the build error by running it manually locally. It's no longer an issue since EmberCLI build error will produce a Ruby.

@tigershen23
Copy link

@rwz awesome, thanks!

@tigershen23
Copy link

@rwz any reason why the ember build could succeed but not make it all the way through to the view render on heroku as in #112? I've got it working with @seanpdoyle's instructions, so I'm willing to chalk this up as user error if it seems that way to you.

@rwz
Copy link
Collaborator

rwz commented Mar 15, 2015

What was the issue? What exactly failed?

@tigershen23
Copy link

@rwz I've rolled it back to the broken state: https://tiger-fuego.herokuapp.com/. Repo at that SHA was here. As you can see, the CSS classes/id's aren't being injected and the HTML content isn't coming through from ember even though the build succeeded (log can be found in #112).

As I said, I eventually got it working, so not a show-stopper. Just passing it along.

@gordonbisnor
Copy link

As per @seanpdoyle's repo, changing this line in package.json from README

"postinstall": "../../node_modules/bower/bin/bower install" 

to this worked for me:

"postinstall": "node_modules/.bin/bower install"

@rwz
Copy link
Collaborator

rwz commented Mar 15, 2015

postinstall hook should point to the path where your bower installation would be. it depends on the location of your app and the way you manage your dependencies.

@rwz
Copy link
Collaborator

rwz commented Mar 15, 2015

@tigershen23 your frontend.js and vendor.js are both empty. Figure out why.

@gordonbisnor
Copy link

@rwz should the README clarify that the path is something individuals will need to figure out for themselves? I folllowed the README verbatim and it did not for me, so could this potentially be a point of confusion for others as well?

@rwz
Copy link
Collaborator

rwz commented Mar 15, 2015

@gordonbisnor probably. The point is, there should be be bower on the deploying stage and it should run before assets:precompile.

@skylar
Copy link

skylar commented Jul 6, 2015

@rwz I just got to this issue after a few hours of trying to blaming sprockets or failed builds or missing assets. I have a multi-app project and forgot to add the "postinstall" hook to my newest ember app before deploy.

It would be great to add a warning or reminder about "postinstall" if this was omitted during a deploy.

For me, the problem (of course) was that /tmp/build_abc/tmp/ember-cli-edf/assets/new_app didn't exist before sprockets was thrown at the rails-side asset roll-up. Would it be easy or reasonable to add a pre-sprockets check or reminder for all active ember-cli apps? If so I'm happy to take a crack at a PR.

@Leooo
Copy link

Leooo commented Aug 13, 2015

Big +1 for skylar comment, it took me ages to see that my postinstall hook was missing (was probably overriden while I updated my Ember-cli version).

@skylar
Copy link

skylar commented Aug 18, 2015

@Leooo at this point, we should probably make that a new issue/ask...

@seanpdoyle
Copy link
Contributor

@skylar @Leooo on personal / client projects, I've moved away from direct Heroku deploys and towards using the Lightning Fast deploy approach.

I have a standing PR #172 to integrate the Redis-backed approach to ember-cli-rails.

It might not make sense to integrate that with this gem. If that's the case, I'll cut a separate gem for it.

TL;DR my suggestion is to look into alternatives, unless @rwz or @rondale-sc have had success stories they can share.

@skylar
Copy link

skylar commented Aug 18, 2015

@seanpdoyle I'd agree that another approach is ideal for most deploys, but right now it's an issue of migration or scale. If you have a new project you'll likely invest time in something more explicit for deploys. I've seen this project as a helpful stepping stone for pre-embercli projects, or small experiments that want a quick no-hassle heroku-push-deploy.

My thought on your PR is that it looks mostly independent of ember-cli-rails so it would be easiest to consider/review as it's own gem. If you do roll that up, ping me and I'll review it as standalone. thx!

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

8 participants