Comments (6)
Okay, I see how this could be confusing.
The error message "No async task available!" tells you what is wrong but not how to rectify it.
It gave me an idea, maybe Ruby exceptions should include a URL field by default, which allows us to link them through to more documentation. It seems logical to me.
But short of that, what you need to do is use an Async do ... end
block. Generally, for APIs, this is not needed since you'd probably be doing a set of operations in a "single transaction". That being said I completely agree that it's non-obvious what to do.
So, I'll try to fix this by documentation, some more examples, etc.
from cloudflare.
Ah, it was another block of code I had not updated. Apologies. For anyone else:
- client = Cloudflare.connect(key: CF_KEY, email: CF_EMAIL)
- zone = client.zones.find_by_name("contribsys.com")
- dns_records = zone.dns_records.all
- dns_records.each do |elm|
- puts elm
+ Cloudflare.connect(key: CF_KEY, email: CF_EMAIL) do |client|
+ zone = client.zones.find_by_name("contribsys.com")
+ zone.dns_records.each do |elm|
+ puts elm
+ end
end
from cloudflare.
Sorry, I'm not quite sure what is going on here, are you saying the API in v4 broke in a minor release, or broke between v3 and v4 and the documentation/behaviour could be improved?
from cloudflare.
I was using connect without a block in v3. It was working fine. I upgraded to v4 and it broke with the backtrace above. I switched to the block form and it solved the problem. Ergo I assume the major version bump was for the new style of usage but I was surprised that the old style wasn't explicitly broken to make the upgrade path clearer for users..
from cloudflare.
Ran into this again today. Upgraded all my gems and got the same behavior. Googled and found I was the first hit.
No async task available!
/Users/mperham/.gem/ruby/3.0.3/gems/async-1.30.3/lib/async/task.rb:189:in `current'
/Users/mperham/.gem/ruby/3.0.3/gems/async-io-1.33.0/lib/async/io/host_endpoint.rb:55:in `connect'
/Users/mperham/.gem/ruby/3.0.3/gems/async-io-1.33.0/lib/async/io/ssl_endpoint.rb:92:in `connect'
/Users/mperham/.gem/ruby/3.0.3/gems/async-http-0.56.6/lib/async/http/endpoint.rb:201:in `connect'
/Users/mperham/.gem/ruby/3.0.3/gems/async-http-0.56.6/lib/async/http/client.rb:199:in `block in make_pool'
/Users/mperham/.gem/ruby/3.0.3/gems/async-pool-0.3.10/lib/async/pool/controller.rb:254:in `create_resource'
/Users/mperham/.gem/ruby/3.0.3/gems/async-pool-0.3.10/lib/async/pool/controller.rb:305:in `get_resource'
/Users/mperham/.gem/ruby/3.0.3/gems/async-pool-0.3.10/lib/async/pool/controller.rb:271:in `block in available_resource'
/Users/mperham/.gem/ruby/3.0.3/gems/async-1.30.3/lib/async/semaphore.rb:80:in `acquire'
/Users/mperham/.gem/ruby/3.0.3/gems/async-pool-0.3.10/lib/async/pool/controller.rb:270:in `available_resource'
/Users/mperham/.gem/ruby/3.0.3/gems/async-pool-0.3.10/lib/async/pool/controller.rb:236:in `wait_for_resource'
/Users/mperham/.gem/ruby/3.0.3/gems/async-pool-0.3.10/lib/async/pool/controller.rb:96:in `acquire'
/Users/mperham/.gem/ruby/3.0.3/gems/async-http-0.56.6/lib/async/http/client.rb:106:in `call'
/Users/mperham/.gem/ruby/3.0.3/gems/protocol-http-0.22.6/lib/protocol/http/middleware.rb:50:in `call'
/Users/mperham/.gem/ruby/3.0.3/gems/protocol-http-0.22.6/lib/protocol/http/accept_encoding.rb:50:in `call'
/Users/mperham/.gem/ruby/3.0.3/gems/protocol-http-0.22.6/lib/protocol/http/middleware.rb:50:in `call'
/Users/mperham/.gem/ruby/3.0.3/gems/async-rest-0.12.4/lib/async/rest/representation.rb:103:in `block (2 levels) in <class:Representation>'
/Users/mperham/.gem/ruby/3.0.3/gems/async-rest-0.12.4/lib/async/rest/representation.rb:119:in `value!'
/Users/mperham/.gem/ruby/3.0.3/gems/async-rest-0.12.4/lib/async/rest/representation.rb:134:in `value'
<internal:kernel>:90:in `tap'
/Users/mperham/.gem/ruby/3.0.3/gems/async-rest-0.12.4/lib/async/rest/resource.rb:84:in `get'
/Users/mperham/.gem/ruby/3.0.3/gems/cloudflare-4.3.0/lib/cloudflare/paginate.rb:29:in `each'
from cloudflare.
Awesome!
from cloudflare.
Related Issues (20)
- I cant list blocked ip address HOT 2
- Delete/Update HOT 3
- Verify exist subdmain? HOT 1
- zone.record seems to be nil HOT 2
- getting error after migration to async-rest HOT 4
- No async task available HOT 7
- Deleting a single dns record HOT 4
- [Feature] Get DNS record from a token that is not allowed to list all zones HOT 1
- [Bug?] All exceptions are catched in the connection block HOT 1
- Equivalent of `TRAVIS_JOB_ID`? HOT 1
- Async::REST::Error: Unknown content type: application/octet-stream! on reading from KV HOT 6
- Pagination does not seem to work HOT 9
- HTTP configuration missing
- Undefined method "Sync" when using cloudflare-dns-update HOT 4
- delete a record HOT 3
- Readme: link to API docs at Cloudflare HOT 2
- Not compatible with ruby 3.X HOT 7
- [Feature] Add support for KV namespace write key value expiration and expiration_ttl
- async-http upgrade breaks connection HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloudflare.