Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An attempt to run a request with a Faraday::Connection without adapter has been made. (RuntimeError) #1362

Closed
jareko999 opened this issue Jan 4, 2022 · 6 comments
Labels
info Generic question on how to use Faraday

Comments

@jareko999
Copy link

jareko999 commented Jan 4, 2022

Basic Info

  • Faraday Version: 2.0.0, from the job log
  • Ruby Version: latest
  • Node Version: latest

Issue description

GitLab CI failing due to:

/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.

My CI file deployed just fine yesterday. See my versions above.

CI File

image: node:latest
stages:
  - production

production:
  type: deploy
  stage: production
  image: ruby:latest
  script:
    - apt-get update -qy
    - apt-get install -y ruby-dev
    - gem install dpl
    - dpl --provider=heroku --app=blueprint-careers --api-key=$HEROKU_API_KEY
  only:
    - master

Job output

$ gem install dpl
Successfully installed dpl-1.10.16
1 gem installed
$ dpl --provider=heroku --app=blueprint-careers --api-key=$HEROKU_API_KEY
Installing deploy dependencies
Successfully installed rendezvous-0.1.3
Successfully installed netrc-0.11.0
Successfully installed faraday-2.0.0
Successfully installed dpl-heroku-1.10.16
4 gems installed
Preparing deploy
No stash entries found.
/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>'
@iMacTia
Copy link
Member

iMacTia commented Jan 4, 2022

Hi @jareko999, you (or a gem you depend on) have just updated Faraday to v2.0.
This being a major version, it comes with some backwards incompatible changes, including the one causing the error you see.
Please refer to the UPGRADING.md file for instructions on how to upgrade, or simply fix the Faraday version to < 2.0 in your Gemfile.

@olleolleolle
Copy link
Member

#1360 see here for a workaround for that specific gem.

@iMacTia iMacTia added the info Generic question on how to use Faraday label Jan 4, 2022
@iMacTia
Copy link
Member

iMacTia commented Jan 4, 2022

I'm leaving this open for the time being as I'd expect more people falling into this. Marked it with info label

@jareko999
Copy link
Author

jareko999 commented Jan 4, 2022

Thanks. Looks like dpl was the culprit.

This workaround worked for me: travis-ci/dpl#1247 (comment).

@maidh91
Copy link

maidh91 commented Jan 6, 2022

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

@iMacTia
Copy link
Member

iMacTia commented Jan 6, 2022

I'm closing this because Faraday 2.0.1 has now re-introduced net_http as both a dependency and the default adapter, so there's no need for workarounds anymore 🎉

@iMacTia iMacTia closed this as completed Jan 6, 2022
colindean added a commit to colindean/dpl that referenced this issue Jan 7, 2022
Fixes travis-ci#1247

Although this may not be necessary anymore because Faraday 2.0.1
reverted the change that may Faraday 2.0.0 not work:

lostisland/faraday#1362 (comment)
eivinhb pushed a commit to digipost/digipost-api-client-dotnet that referenced this issue May 28, 2024
Jeg måtte manuelt oppdatere faraday fordi det ble noe feil i 2.0.0.

ref:
lostisland/faraday#1362
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info Generic question on how to use Faraday
Projects
None yet
Development

No branches or pull requests

4 participants