Plots2: octokit error on Travis blocking all PRs

Created on 2 Jun 2018  路  13Comments  路  Source: publiclab/plots2

Hi, @publiclab/reviewers @publiclab/soc - starting an issue to track this. The error is:

0.65s$ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then danger --verbose; fi
/home/travis/.rvm/gems/ruby-2.4.1/gems/octokit-4.9.0/lib/octokit/response/raise_error.rb:16:in `on_complete': GET https://api.github.com/repos/publiclab/plots2/pulls/2738: 401 - Bad credentials // See: https://developer.github.com/v3 (Octokit::Unauthorized)

On this line -- it's caused by this line in .travis.yml:

https://github.com/publiclab/plots2/blob/e802c759f0eb0b92a1fc7cd24d26cceee82e2907/.travis.yml#L26

All PRs are now blocked by this --

Prior notes

It is failing on a Github API endpoint. Look at this pull request https://github.com/octokit/octokit.rb/pull/1016/commits/491476a97e52ea77babab40303a5f01f0a94cf27 possibly they have changed their API or something. But I wonder why our build process depends on the Github API ? (@icarito)

This looks to be an issue with the Danger bot parsing of errors and reporting back the errors in the PR -- which needs GitHub access:

/home/travis/.rvm/gems/ruby-2.4.1/gems/octokit-4.9.0/lib/octokit/response/raise_error.rb:16:in `on_complete': GET https://api.github.com/repos/publiclab/plots2/pulls/2738: 401 - Bad credentials // See: https://developer.github.com/v3 (Octokit::Unauthorized)

Can someone look at Danger's Ruby issue tracker to see if we need to do something to get Danger running again?

We should check that our token works with https://github.com/danger/danger/issues/675#issuecomment-265448151

I think this is the Octokit gem we're using -- i don't see an obvious sign that something with the credentials has changed... https://github.com/octokit/octokit.rb#making-requests

@ViditChitkara found something similar from 21 days ago here: https://github.com/travis-ci/travis-ci/issues/9610


Please chime in with ideas or things you've tried!

Most helpful comment

It worked! OK - looks like this was a token issue. I don't know exactly what happened. Maybe there was a mislabeled token which I deleted? Closing this now. Everyone please re-trigger your Travis builds!

@publiclab/soc @publiclab/reviewers

All 13 comments

Octokit::Unauthorized is odd for https://api.github.com/repos/publiclab/plots2/pulls/2738 since I can directly GET it in a browser...?

I believe it's stuck as Danger is starting, as triggered by that line of .travis.yml.

Looking at how Danger is set up here, keeping in mind that this was working without errors a week ago: http://danger.systems/guides/getting_started.html

Esp. http://danger.systems/guides/getting_started.html#setting-up-an-access-token

I'm trying to create a new token stored in TravisCI - DANGER_GITHUB_API_TOKEN with the public_repos privilege

Testing adding bundle exec to .travis.yml danger call in https://github.com/publiclab/plots2/pull/2759 and if this fails, i'll change the token.

@jywarren i think the question we should be asking is what changed recently in octokit or danger because this was working until recently for no apparent reason.

Agreed, although i do note that https://github.com/publiclab/plots2/blob/master/Dockerfile was modified about 8 days ago... dunno why that'd matter?

I saved a new token and am going to try restarting https://github.com/publiclab/plots2/pull/2738

It worked! OK - looks like this was a token issue. I don't know exactly what happened. Maybe there was a mislabeled token which I deleted? Closing this now. Everyone please re-trigger your Travis builds!

@publiclab/soc @publiclab/reviewers

This is now happening again! Reported by @namangupta01 here: https://github.com/publiclab/plots2/pull/3118#issuecomment-408555241

@publiclab/soc @publiclab/reviewers looking at this now!

Noting this is for the @plotsbot user

Hmm, now I see:

Could not set up API to Code Review site for Danger
For your GitHub repo, you need to expose: DANGER_GITHUB_API_TOKEN
You may also need: DANGER_GITHUB_HOST, DANGER_GITHUB_API_BASE_URL, DANGER_OCTOKIT_VERIFY_SSL
Found these keys in your ENV: MANPATH, XDG_SESSION_ID, MYSQL_UNIX_PORT, rvm_bin_path, HAS_JOSH_K_SEAL_OF_APPROVAL, PYENV_ROOT, NVM_CD_FLAGS, GEM_HOME, TRAVIS_STACK_JOB_BOARD_REGISTER, TRAVIS_TEST_RESULT, TRAVIS_STACK_LANGUAGES, SHELL, TERM, HISTSIZE, ELIXIR_VERSION, IRBRC, SSH_CLIENT, TRAVIS_COMMIT, TRAVIS_OS_NAME, TRAVIS_UID, OLDPWD, MY_RUBY_HOME, SSH_TTY, LC_ALL, MIX_ARCHIVES, NVM_DIR, HISTFILESIZE, USER, _system_type, TRAVIS_LANGUAGE, PERLBREW_BASHRC_VERSION, COMPOSE_FILE, rvm_path, TRAVIS_DIST, TRAVIS, TRAVIS_REPO_SLUG, HAS_ANTARES_THREE_LITTLE_FRONZIES_BADGE, PYTHON_CONFIGURE_OPTS, TRAVIS_BUILD_STAGE_NAME, TRAVIS_COMMIT_MESSAGE, TRAVIS_PULL_REQUEST, PAGER, RACK_ENV, PERLBREW_ROOT, TRAVIS_STACK_TIMESTAMP, rvm_prefix, PYTHON_CFLAGS, PATH, MAIL, TRAVIS_PULL_REQUEST_SHA, TRAVIS_OSX_IMAGE, TRAVIS_RUBY_VERSION, PWD, COVERALLS_REPO_TOKEN, JAVA_HOME, CONTINUOUS_INTEGRATION, LANG, TRAVIS_PRE_CHEF_BOOTSTRAP_TIME, MERB_ENV, TZ, _system_arch, PERLBREW_HOME, PS1, _system_version, TRAVIS_SUDO, TRAVIS_TAG, TRAVIS_ALLOW_FAILURE, RBENV_SHELL, HISTCONTROL, TRAVIS_INIT, rvm_version, TRAVIS_JOB_NUMBER, TRAVIS_EVENT_TYPE, PYENV_SHELL, rvm_pretty_print_flag, PS4, HOME, SHLVL, BUNDLE_GEMFILE, GOROOT, RAILS_ENV, CI, TRAVIS_BUILD_ID, LOGNAME, TRAVIS_STACK_FEATURES, TRAVIS_PULL_REQUEST_SLUG, COMPOSER_NO_INTERACTION, GEM_PATH, SSH_CONNECTION, LC_CTYPE, TRAVIS_SECURE_ENV_VARS, DEBIAN_FRONTEND, NVM_BIN, GOPATH, TRAVIS_STACK_NODE_ATTRIBUTES, TRAVIS_STACK_NAME, GIT_ASKPASS, TRAVIS_BRANCH, XDG_RUNTIME_DIR, TRAVIS_COMMIT_RANGE, JRUBY_OPTS, JDK_SWITCHER_DEFAULT, TRAVIS_PULL_REQUEST_BRANCH, TRAVIS_JOB_ID, RUBY_VERSION, _system_name, TRAVIS_BUILD_DIR, TRAVIS_BUILD_NUMBER, _, BUNDLER_ORIG_BUNDLE_BIN_PATH, BUNDLER_ORIG_BUNDLE_GEMFILE, BUNDLER_ORIG_BUNDLER_ORIG_MANPATH, BUNDLER_ORIG_BUNDLER_VERSION, BUNDLER_ORIG_GEM_HOME, BUNDLER_ORIG_GEM_PATH, BUNDLER_ORIG_MANPATH, BUNDLER_ORIG_PATH, BUNDLER_ORIG_RB_USER_INSTALL, BUNDLER_ORIG_RUBYLIB, BUNDLER_ORIG_RUBYOPT.
Failing the build, Danger cannot run without API access.
You can see more information at https://danger.systems/guides/getting_started.html

Solved by adding a DANGER_GITHUB_API_TOKEN set to display value in build log!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

keshavsethi picture keshavsethi  路  3Comments

grvsachdeva picture grvsachdeva  路  3Comments

milaaraujo picture milaaraujo  路  3Comments

divyabaid16 picture divyabaid16  路  3Comments

keshavsethi picture keshavsethi  路  3Comments