Git Product home page Git Product logo

heroku-buildpack-ember-cli-deploy's Issues

Doesn't support ember in-repo-addons

ember-cli's in-repo-addons are a useful way to isolate or extract code, especially in a monolith repo.

To properly support in-repo-addons, this buildpack would need to parse the package.json file, look for the ember-addon.paths key, and for each path, would need to cd into that path and yarn install (or npm install if there's a package-lock.json).

error running: ember deploy production

I'm getting the following error:


-----> Building ember assets
       The specified command deploy is invalid. For available options, see `ember help`.
remote: Error running: ember deploy production 2>&1
    ...

I'm using:

  #engines
  "node": "6.4.0",
  "npm": "3.10.7",
  "ember-cli": "2.8.0"

  #deploy
  "ember-cli-deploy": "1.0.0-beta.1"
  "ember-cli-deploy-build": "0.1.1"
  "ember-cli-deploy-gzip": "0.2.3"
  "ember-cli-deploy-revision-data": "0.3.0"
  "ember-cli-fastboot": "1.0.0-beta.9"

Not sure what is causing it as, as ember build and ember fastboot --serve-assets and ember deploy production both work locally.

`npm install` fastboot dependencies removes node_modules if using `yarn.lock`

I'm using the meta emberjs buildpack that relies on this one, and running into an issue with node_modules not being present at Heroku.

In addition to the devDependencies necessary for building my ember app, I have one production dependency (rollbar, the error reporter) that I'm using when running the fastboot app at Heroku.
My Procfile runs a node script to launch the app:

# Procfile
web: node serve.js
// serve.js
const FastBootAppServer = require('fastboot-app-server');
const Rollbar = require('rollbar');

let rollbar;

if (process.env.ROLLBAR_ACCESS_TOKEN) {
  rollbar = new Rollbar(process.env.ROLLBAR_ACCESS_TOKEN);
}

let server = new FastBootAppServer({
  distPath: 'dist',
  gzip: true, // Optional - Enables gzip compression.
  host: '0.0.0.0', // Optional - Sets the host the server listens on.
  afterMiddleware(app) {
    if (rollbar) {
      app.use(rollbar.errorHandler());
    }
  }
});

server.start();

When I attempt to push this to Heroku the build succeeds but running the app fails because it cannot find the module "rollbar".

I'm also using yarn (and a committed yarn.lock) file with this project, which turns out to be the source of my issue.

I believe this is the sequence of events that happens when pushing to heroku:

  • heroku-buildpack-emberjs sets NPM_CONFIG_PRODUCTION to false
  • heroku-buildpack-emberjs runs the heroku-buildpack-nodejs buildpack, which, due to presence of yarn.lock installs node modules using yarn (I'm not sure if the NPM_CONFIG_PRODUCTION:false is still set here and if it is required for the yarn install to work โ€” either way, the yarn install does work and the devDependencies are installed at this point)
  • heroku-buildpack-emberjs runs this buildpack, and it uses npm to install again (and conditionally also run npm install fastboot-cli) โ€” I'm not sure the value of NPM_CONFIG_PRODUCTION at this point, but I believe that the result of that npm install is some of the deps installed by yarn earlier are now removed. The Heroku output contains some lines like this:
remote: npm notice created a lockfile as package-lock.json. You should commit this file.
remote: + [email protected]
remote: added 8 packages, removed 1151 packages and updated 123 packages in 15.857s

After this, I can use heroku run bash to get to a shell and verify that node_modules/rollbar is no longer present (and my app crashes when it tries to start due to the require('rollbar') failing.

There are two successful workarounds I've attempted:

  • remove the yarn.lock and commit a package-json.lock
  • move all of my devDependencies into dependencies

I think that if this code were changed to use yarn when present, that may solve this problem:

pipe_exit_on_error("cd #{tuple.output_dir} && npm install 2>&1", @output_io, @error_io, @env)
@output_io.topic "Caching fastboot dependencies"
@cache.store("#{cache_tuple.destination}/node_modules", cache_tuple.source)
unless command_success?("node_modules/.bin/ember-fastboot 2> /dev/null")
@output_io.topic "ember-fastboot command not detected, installing fastboot-cli"
pipe_exit_on_error("npm install fastboot-cli", @output_io, @error_io, @env)
end

remote: /tmp/buildpack1DnQW/bin/detect: line 5: /tmp/buildpack1DnQW/vendor/buildpack: No such file or directory

I have a small Ember application that I want to deploy to Dokku.

.buildpacks:

https://github.com/heroku/heroku-buildpack-nodejs.git
https://github.com/heroku/heroku-buildpack-ember-cli-deploy.git

During the deployment, I get this error:

       [4/4] Building fresh packages...
       warning Ignored scripts due to flag.
       Done in 16.36s.

-----> Build succeeded!
       !     Unmet dependencies don't fail yarn install but may cause runtime issues
       https://github.com/npm/npm/issues/7494

=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-ember-cli-deploy.git
remote: /tmp/buildpack1DnQW/bin/detect: line 5: /tmp/buildpack1DnQW/vendor/buildpack: No such file or directory

Could you please help me solve this problem?

Identical problem for: heroku/heroku-buildpack-emberjs#51

Support building for environments other than production

Currently we've got ember deploy production or ember build --environment production hard-coded here: https://github.com/heroku/heroku-buildpack-ember-cli-deploy/blob/master/buildpack/mrblib/buildpack/commands/compile.rb#L39-L43

I've got a client who primarily needs to be building production apps, but has some cases where we need the flexibility to build a staging app as well. In the older tonycoco build pack they support an EMBER_ENV environment variable that allows that to be toggled (see https://github.com/tonycoco/heroku-buildpack-ember-cli#environment)

Any chance we'd be able to do something similar here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.