Issues with Deploying to Heroku via Travis-CI - heroku

I keep getting this error when deploying with Heroku and have been getting it with several different reports that I'm trying to deploy to Heroku after running their build through Travis.
No stash entries found.
API request failed.
Message: Invalid credentials provided.
Reference:
failed to deploy
I don't get any more information than that.I tried updating my Heroku API key but that didn't seem to work. I've used the Travis setup Heroku command as well as creating the build step manually, but I still get the same error. Here's what the deploy section of my .travis.yml file looks like
deploy:
provider: heroku
api_key:
secure: g3gj25vI58r48P63E...
app: heroku-travis-test-01
on:
repo: andrico1234/heroku-travis-test
Is this a common issue?
Edited: Adding Travis' install dependencies stack trace
2.71s$ rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install dpl
Fetching: dpl-1.10.0.gem (100%)
Successfully installed dpl-1.10.0
1 gem installed
dpl.1
Installing deploy dependencies
Fetching: multipart-post-2.0.0.gem (100%)
Successfully installed multipart-post-2.0.0
Fetching: faraday-0.15.2.gem (100%)
Successfully installed faraday-0.15.2
Fetching: rendezvous-0.1.2.gem (100%)
Successfully installed rendezvous-0.1.2
Fetching: netrc-0.11.0.gem (100%)
Successfully installed netrc-0.11.0
Fetching: dpl-heroku-1.10.0.gem (100%)
Successfully installed dpl-heroku-1.10.0
5 gems installed

For some reason heroku auth:token was returning a wrong token for me, even after making sure that I was logged in to heroku on the command line.
After trying all the solutions posted, what worked for me was:
Go to Heroku Account
Manually copy the API Key and then paste it into command line:
For the ones hosted at travis-ci.com:
travis encrypt pasteAPIKeyHere --add deploy.api_key --pro
For the ones hosted at travis-ci.org:
travis encrypt pasteAPIKeyHere --add deploy.api_key --org
Hope this helps.

This is an encryption issue, depending on where your Travis account is hosted (travis-ci.com or travis-ci.org) & if your project is public.
I use a public project connected on travis-ci.com, and the command given by Travis-ci doc about deploy to Heroku isn't working :
travis encrypt $(heroku auth:token) --add deploy.api_key
To guarantee a correct encryption use --org (for travis-ci.org) or --pro (for travis-ci.com) tag, in my case :
travis encrypt $(heroku auth:token) --add deploy.api_key --pro
See Travis-CI issue #10018.

Fixed it by doing this:
deploy:
provider: heroku
api_key:
secure: ENCRYPTED_API_KEY
app: simple-e-shop <--------------------
on:
repo: john-doe/simple-eshop
Before I had the app name the same as the name of the GitHub repo. But if should be the name of heroku app. The difference was in one dash character, and it worked!

In my case I had to login again using travis login --pro and then travis encrypt $(heroku auth:token) --add deploy.api_key --pro generate proper api-key. I use free Travis version.
This is mentioned in Travis Heroku doc: https://docs.travis-ci.com/user/deployment/heroku/
travis command defaults to using travis-ci.org as the API endpoint. If
your build runs on travis-ci.com (even if your repository is public),
add --pro flag to override this:
travis encrypt $(heroku auth:token) --add deploy.api_key --pro

Related

Deploy on heroku with dpl not working with new farady version

My CI/CD on gitlab deploy code on heroku using dpl. It have been working like a charm until a new version of faraday (I guess it is the reason) is fetch.
Here is what I had in my gitlab CI terminal when it worked (yesterday) :
...
$ dpl --provider=heroku --app=$HEROKU_STAGING_APP --api-key=$HEROKU_API_KEY
Installing deploy dependencies
Successfully installed rendezvous-0.1.3
Successfully installed netrc-0.11.0
Successfully installed multipart-post-2.1.1
Successfully installed faraday-rack-1.0.0
Successfully installed faraday-patron-1.0.0
Successfully installed faraday-net_http_persistent-1.2.0
Successfully installed faraday-net_http-1.0.1
Successfully installed faraday-httpclient-1.0.1
Successfully installed faraday-excon-1.1.0
Successfully installed faraday-em_synchrony-1.0.0
Successfully installed faraday-em_http-1.0.0
Successfully installed faraday-1.8.0
Successfully installed dpl-heroku-1.10.16
13 gems installed
authentication succeeded
checking for app XXX
found app XXX
Preparing deploy
...
Here is what I get today :
...
$ dpl --provider=heroku --app=$HEROKU_STAGING_APP --api-key=$HEROKU_API_KEY
Installing deploy dependencies
Successfully installed rendezvous-0.1.3
Successfully installed netrc-0.11.0
Successfully installed faraday-2.0.0
Successfully installed dpl-heroku-1.10.16
4 gems installed
Preparing deploy
No stash entries found.
/usr/local/bundle/gems/faraday-2.0.0/lib/faraday/rack_builder.rb:230:in `ensure_adapter!': An attempt to run a request with a Faraday::Connection without adapter has been made. (RuntimeError)
Please set Faraday.default_adapter or provide one when initializing the connection.
...
I tried to add --skip_cleanup to dpl call as seen here but it is not working. Maybe I can force reussing the older version of faraday ? But I can't find any source to try this.
This might be useful for this case
https://github.com/travis-ci/dpl/issues/1247

How to install SVN at heroku?

I have a project that needs SVN to install some packages. Specifically, I depend on node-steam-resources and its installation instructions say
Run npm install seishun/node-steam-resources. It fetches the Steam resources and requires svn.
On localhost it works after installing SVN console.
But how to do the same on Heroku?
You'll need to use the apt buildpack to install OS-level packages in addition to your existing buildpack (presumably heroku/nodejs).
Create a new file called Aptfile in the root of your repository. This is where you will define any additional Ubuntu packages you require.
Edit that file so it looks like this:
subversion
Add and commit that file.
Configure your Heroku app to use the correct buildpacks:
First, set your Node.js buildpack explicitly:
heroku buildpacks:set heroku/nodejs
Then add the apt buildpack:
heroku buildpacks:add --index 1 heroku-community/apt
Run heroku buildpacks to make sure you see both buildpacks, with the apt buildpack showing up first and the Node.js buildpack showing up second.
Finally, redeploy your application and watch the build output. You should see the subversion package get installed, then your Node.js dependencies get installed.

How can I add plugin to heroku repo?

I gave heroku plugins:install heroku-first-blog on terminal.I got an error something like this
Installing plugin heroku-first-blog... !
▸ Plugin not found
! error installing plugin heroku-first-blog
To use heroku plugins you need to specify the plugins git repository URL. For instance, if you wanted to install the heroku accounts plugin you might say:
heroku plugins:install https://github.com/ddollar/heroku-accounts.git
Here's what happens when I run this command locally myself:
$ heroku plugins:install https://github.com/ddollar/heroku-accounts.git
Installing https://github.com/ddollar/heroku-accounts.git... done

Shapado: deploy on heroku failed with system package missing error

I have successfully ran the shapado rails application on my local system(am using ubuntu). But While running the bundle install, it fails with following error
configure: error: Neither uuid/uuid.h nor uuid.h found - required for
brass, chert and flint (you may need to install the uuid-dev,
libuuid-devel or e2fsprogs-devel package)
Then I installed the packages by using
sudo apt-get install uuid-dev
sudo apt-get install libqt4-dev
While running the rake task
rake bootstrap RAILS_ENV=development
Got some nil error and fixed the same by applying below patch
Called id for nil
After this, I can able to run the application on my local successfully.
When I tried to deploy on Heroku it fails with
configure: error: Neither uuid/uuid.h nor uuid.h found - required for brass, chert and flint (you may need to install the uuid-dev, libuuid-devel or e2fsprogs-devel package)
it tries to install the gem 'xapian-ruby', '1.2.7.1' and fails due to unavailable of packages.
Is any one facing the same issue. Suggest me to sort this out.
Deploying shapado to heroku would require you to make a custom buildpack that has the binary dependencies that shapado needs built in. Instructions on how to do that can be found here https://blog.heroku.com/archives/2012/11/13/hacking-buildpacks. It is possible though.

How to Download Heroku on mac

I have been trying to download Heroku software to upload the rails app I made but every time I try to download it, it says it failed.
And what version of heroku should I be downloading?
if you have installed node and npm already, try this
npm install -g heroku
if you're using Homebrew, try this
brew tap heroku/brew && brew install heroku
once the installation is done, issue this to verify whether you've successfully installed Heroku on your Mac
heroku --version
You need to set up your local workstation with the Heroku command-line client and the Git revision control system by installing the Heroku Toolbelt. Check out this link to download Heroku toolbelt.
Heroku is a hosting service and there is nothing to download. You can sign up at Heroku.com and there are instructions on the site for how to upload your app.

Resources