travis-ci / dpl

Dpl (dee-pee-ell) is a deploy tool made for continuous deployment.
MIT License
1.29k stars 367 forks source link

RuntimeError: An attempt to run a request with a Faraday::Connection without adapter has been made #1247

Open oleksii-mykhniak opened 2 years ago

oleksii-mykhniak commented 2 years ago

I'm using dpl in GitLab for Heroku CI/CD and I have the next error:

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

It looks like a problem in the faraday-2.0.0 release which was a few minutes ago here

felin-arch commented 2 years ago

Here is a quick and dirty workaround.

Add gem install faraday -v 1.8.0 before running dpl --provider=heroku --app=$APP --api-key=$HEROKU_API_KEY.

It ain't pretty, but DEV's got to deploy.

dzcar commented 2 years ago

It looks like the change affected was https://github.com/lostisland/faraday/pull/1354

maidh91 commented 2 years ago

This is my update for Gitlab CI, works perfectly with Faraday 1.8.0

deploy:
  stage: deploy
  only:
    - master
  image: ruby:latest
  script:
    - gem install dpl && gem install faraday -v 1.8.0
    - dpl --provider=heroku --app=xxx --api-key=$HEROKU_API_KEY
colindean commented 2 years ago

https://github.com/lostisland/faraday/issues/1362#issuecomment-1006958547 says that Faraday 2.0.1 reverted/fixed the change that made Faraday 2.0.0 not work but I put up #1249 just in case that doesn't work or it changes, so that someone who is maintaining dpl can qualify dpl against Faraday 2.x properly.

farrukh-malik commented 2 years ago

I faced the same problem today. Apparently there is some problem in the latest version of FARADAY, at the moment. I solved it this way: add manual installation of the previous version of the dependency to your .gitlab.yml, and everything will work. Have a nice day.

before_script:
  - apt-get update -qy
  - apt-get install -y ruby-dev
  - gem install dpl
  - gem install faraday -v 1.8.0