Andrico Karoulla
Andrico Karoulla

Reputation: 91

Issues with Deploying to Heroku via Travis-CI

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

Upvotes: 9

Views: 5548

Answers (4)

Navidot
Navidot

Reputation: 325

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

Upvotes: 0

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!

Upvotes: 0

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.

Upvotes: 12

freezed
freezed

Reputation: 1339

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.

Upvotes: 2

Related Questions