Heroku deploy fails, installing dpl-heroku encounters faraday error

The Travis Heroku deployment phase in Ruby applications is currently failing due to an error installing dpl-heroku. We are seeing this error across multiple Ruby applications. The applications use Ruby >2.6. The error output is:

dpl.1

Installing deploy dependencies

ERROR:  Error installing dpl-heroku:

	The last version of faraday (>= 0) to support your Ruby & RubyGems was 1.8.0. Try installing it with `gem install faraday -v 1.8.0` and then running the current command again

	faraday requires Ruby version >= 2.6. The current ruby version is 2.4.5.335.

Successfully installed ruby2_keywords-0.0.5

/home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- dpl/provider/heroku (LoadError)

	from /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'

	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.16/lib/dpl/provider.rb:93:in `rescue in block in new'

	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.16/lib/dpl/provider.rb:68:in `block in new'

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

	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.16/lib/dpl/provider.rb:67:in `new'

	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.16/lib/dpl/cli.rb:31:in `run'

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

	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.16/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>'

A sample Travis deploy config:

deploy:
  provider: heroku
  strategy: git
  app:
    master: [REDACTED]
  api_key:
    secure: [REDACTED_TOKEN]

Please let me know if any further information is needed. Thank you!

2 Likes

Tried to upgrade the machine to Focal from Xenial in order to work around this issue (Focal default Ruby is 2.7.1), now running into this issue

/home/travis/.rvm/gems/ruby-2.7.1/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.
For more info, check https://lostisland.github.io/faraday/usage/.
	from /home/travis/.rvm/gems/ruby-2.7.1/gems/faraday-2.0.0/lib/faraday/rack_builder.rb:166:in `app'
	from /home/travis/.rvm/gems/ruby-2.7.1/gems/faraday-2.0.0/lib/faraday/rack_builder.rb:153:in `build_response'
	from /home/travis/.rvm/gems/ruby-2.7.1/gems/faraday-2.0.0/lib/faraday/connection.rb:445:in `run_request'
	from /home/travis/.rvm/gems/ruby-2.7.1/gems/faraday-2.0.0/lib/faraday/connection.rb:200:in `get'
	from /home/travis/.rvm/gems/ruby-2.7.1/gems/dpl-heroku-1.10.16/lib/dpl/provider/heroku/generic.rb:43:in `check_auth'
	from /home/travis/.rvm/gems/ruby-2.7.1/gems/dpl-1.10.16/lib/dpl/provider.rb:187:in `block in deploy'
	from /home/travis/.rvm/gems/ruby-2.7.1/gems/dpl-1.10.16/lib/dpl/cli.rb:41:in `fold'
	from /home/travis/.rvm/gems/ruby-2.7.1/gems/dpl-1.10.16/lib/dpl/provider.rb:186:in `deploy'
	from /home/travis/.rvm/gems/ruby-2.7.1/gems/dpl-1.10.16/lib/dpl/cli.rb:32:in `run'
	from /home/travis/.rvm/gems/ruby-2.7.1/gems/dpl-1.10.16/lib/dpl/cli.rb:7:in `run'
	from /home/travis/.rvm/gems/ruby-2.7.1/gems/dpl-1.10.16/bin/dpl:5:in `<top (required)>'
	from /home/travis/.rvm/gems/ruby-2.7.1/bin/dpl:23:in `load'
	from /home/travis/.rvm/gems/ruby-2.7.1/bin/dpl:23:in `<main>'
failed to deploy

Was able to workaround by adding the following to the before_deploy stage:
- rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install faraday -v 1.8.0

3 Likes

I’ve started running into maybe something similar to this too, with Gitlab CI. Deploys up until today have worked just fine. This also seems like it is related to the version of Faraday.

/var/lib/gems/2.7.0/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.

EDIT For whoever is searching for this: I was able to solve the issue on Gitlab CI by including this command in my .yml:

    - gem install faraday -v 1.8.0

right before I installed dpl.

I’ll try and find the bash script (if not write it myself) that fixes this issue with Faraday. I know it’s in my git somewhere. I’ll be on the lookout for it today.

Thanks.

4 Likes

Any update here? The Travis deploy phase for Heroku is still broken with the same error as of 1/7/22. Thanks!

1 Like

Confirming that I was able to get past a very similar issue:

ERROR: Error installing dpl-heroku:

1263 The last version of faraday (>= 0) to support your Ruby & RubyGems was 1.9.3. Try installing it with `gem install faraday -v 1.9.3` and then running the current command again

1264 faraday requires Ruby version >= 2.6. The current ruby version is 2.4.5.335.

by using - rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install faraday -v 1.8.0 as suggested by @zopz.

example here…

...
before_deploy:
  - rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install faraday -v 1.8.0
deploy:
  provider: heroku
  api_key: $HEROKU_API_KEY
...

Seeming unlikely that anything will be fixed here, but any update? We’ve implemented workarounds for now but the out of box Heroku deploy phase is still broken.