Release uploads, but job fails with weird error

https://travis-ci.org/In-line/grip/jobs/519408681

/home/travis/.rvm/gems/ruby-2.4.5/gems/octokit-4.6.2/lib/octokit/response/raise_error.rb:16:in `on_complete’: GET https://api.github.com/user: 401 - Bad credentials // See: https://developer.github.com/v3 (Octokit::Unauthorized)

from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/response.rb:9:in `block in call’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/response.rb:61:in `on_complete’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/response.rb:8:in `call’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/octokit-4.6.2/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/octokit-4.6.2/lib/octokit/middleware/follow_redirects.rb:61:in `call’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/rack_builder.rb:143:in `build_response’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/connection.rb:387:in `run_request’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/connection.rb:138:in `get’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/sawyer-0.8.1/lib/sawyer/agent.rb:94:in `call’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/octokit-4.6.2/lib/octokit/connection.rb:154:in `request’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/octokit-4.6.2/lib/octokit/connection.rb:19:in `get’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/octokit-4.6.2/lib/octokit/client/users.rb:34:in `user’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-releases-1.10.8/lib/dpl/provider/releases.rb:58:in `user’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-releases-1.10.8/lib/dpl/provider/releases.rb:83:in `setup_auth’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-releases-1.10.8/lib/dpl/provider/releases.rb:87:in `check_auth’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.8/lib/dpl/provider.rb:187:in `block in deploy’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.8/lib/dpl/cli.rb:41:in `fold’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.8/lib/dpl/provider.rb:186:in `deploy’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.8/lib/dpl/cli.rb:32:in `run’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.8/lib/dpl/cli.rb:7:in `run’

from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.8/bin/dpl:5:in `<top (required)>’

from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `load’

from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `<main>’

failed to deploy

GET https://api.github.com/user: 401 - Bad credentials // See: https://developer.github.com/v3 (Octokit::Unauthorized)

Are you sure your encrypted Github API key in .travis.yml is correct? Note that as per https://docs.travis-ci.com/user/encryption-keys/ , Travis key pair is per-repository, so you need to somehow indicate to the travis encrypt command which key it is supposed to use (by either running the command in your project directory, or by passing -r).

hello :slight_smile:

today i setup a repo and got about the same error:
https://www.travis-ci.com/s-light/quasar_test/jobs/208717489#L532

/Users/travis/.rvm/gems/ruby-2.4.3/gems/octokit-4.6.2/lib/octokit/response/raise_error.rb:16:in `on_complete’: GET https://api.github.com/user: 401 - Bad credentials // See: https://developer.github.com/v3 (Octokit::Unauthorized)

but also this lead to a failed build -
the upload itself worked - its done by the electron-builder - but this means the GH_TOKEN set in the repository environment variable is correct…

is this a sort of timing problem that two services try to login at the same time?! or something similar?

iam new to all of this - so i am sure my experiments do not make full sens at the current state… :wink:

my .travis.yml just contains

language: node_js
node_js:
    - "12"

# https://docs.travis-ci.com/user/multi-os/
os:
    - linux
    - osx
dist: xenial

cache: yarn

addons:
  apt:
    packages:
        - libusb-1.0-0
        - libusb-1.0-0-dev
        - libudev-dev

before_deploy:
    - yarn release
deploy:
    provider: releases
    api_key: GH_TOKEN
    # file: "FILE TO UPLOAD"
    skip_cleanup: true
    draft: true
    # on:
#     tags: true

first i had accidentally setup my repor with https://travis-ci.org/
after i found some mentionings that this error message can have to do with the move to travis-ci.com i moved my experiment to the .com version…
but this did not fix it…

hope anyone can give me a hint why this error appears.

sunny greetings
stefan

Your API key is plain GH_TOKEN


which is most definitely incorrect.

If you have it set correctly https://www.travis-ci.com/s-light/quasar_test/jobs/208717488#L216, you’d want $GH_TOKEN in the file instead.

1 Like

thanks!!:blush:
yeah that makes sens!!!