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

ActiveJob initialization issue: ActiveJob::QueueAdapters::CloudtaskerAdapter not loaded properly #19

Closed
jan-kaczorowski opened this issue Dec 15, 2020 · 15 comments
Assignees
Labels
bug Something isn't working

Comments

@jan-kaczorowski
Copy link

Rails v. 5.2.2
Cloudtasker gem v. 0.11.rc2

After configuring the project as instructed in README, error is being thrown on launch. Looks like ActiveJob::QueueAdapters::CloudtaskerAdapter is not loaded properly from gem.
config/environments/production.rb|development.rb files, where executing config.active_job.queue_adapter = :cloudtasker are hitting against class that's not initialized.

rails c                                                                                                                                                   ─╯
D, [2020-12-15T15:40:54.183325 #4277] DEBUG -- : [httplog] Connecting: oauth2.googleapis.com:443
D, [2020-12-15T15:40:54.377321 #4277] DEBUG -- : [httplog] Sending: POST http://oauth2.googleapis.com:443/token
D, [2020-12-15T15:40:54.377556 #4277] DEBUG -- : [httplog] Data: grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJ0ZXN0LWdvb2dsZS10YXNrc0BzcGFjZW9zLW1vbml0b3IuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20iLCJhdWQiOiJodHRwczovL29hdXRoMi5nb29nbGVhcGlzLmNvbS90b2tlbiIsImV4cCI6MTYwODA0MzMxNCwiaWF0IjoxNjA4MDQzMTk0LCJzY29wZSI6Imh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL2F1dGgvbG9nZ2luZy5hZG1pbiJ9.SIvanU_wFFNp6sKGqzUqTaG9E-LmiL-CMsILp4JYBFIaAtDGbCyLk57BwqTmCpiWVfU6t1oORQA9LQoyZ-NGnxXSwKrZc942NJe8Kr7D7Qr3JUANyTrmUPJLJlIbQNLKqqFe4kbiQ3ik52g1QsYATwslGZYA2HTyde_b11TqfauottpWGvn50p_hqb5WNZYRp6ehFCNZiN91LaSFftMFSFo2-EDfqbgKfN5nI4lV-Mblpq2pO9s4dzVgH3Zgd1h4896lYs-c_pPHUIR3NbitcqOYl3LHQX2HyMvyQstbFnD0StVY_pfyFrKDXuFcpYAziswSkq98LjRMuqE2Xy9XaA
D, [2020-12-15T15:40:54.377690 #4277] DEBUG -- : [httplog] Status: 200
D, [2020-12-15T15:40:54.378064 #4277] DEBUG -- : [httplog] Benchmark: 0.059908 seconds
D, [2020-12-15T15:40:54.378514 #4277] DEBUG -- : [httplog] Response:
{"access_token":"ya29.c.Kp0B6gdcmDLOqbeM6hTKjl9SZTuhbncrIehzMvc7FCmDM8vP4vwzK1masDffsno5iByBCrghZOzW8XKUhbV4NxiIUVD-L7xquThTokP91eOqMJHS1ZN4C-RukYT_u_HGjdfMEftyL1-MgfYsMTM1HyTpoyC3PFBefH3ugXDHPSRCtyjizgSPYPWZs5JFw_P2SrIIRy-KG2C-lP13lSKmLg","expires_in":3599,"token_type":"Bearer"}
/home/janek/.rvm/gems/ruby-2.6.6/gems/activejob-5.2.4.4/lib/active_job/queue_adapters.rb:135:in `const_get': uninitialized constant ActiveJob::QueueAdapters::CloudtaskerAdapter (NameError)
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activejob-5.2.4.4/lib/active_job/queue_adapters.rb:135:in `lookup'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activejob-5.2.4.4/lib/active_job/queue_adapter.rb:35:in `queue_adapter='
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activejob-5.2.4.4/lib/active_job/railtie.rb:20:in `block (3 levels) in <class:Railtie>'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activejob-5.2.4.4/lib/active_job/railtie.rb:20:in `each'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activejob-5.2.4.4/lib/active_job/railtie.rb:20:in `block (2 levels) in <class:Railtie>'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activesupport-5.2.4.4/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activesupport-5.2.4.4/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activesupport-5.2.4.4/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activesupport-5.2.4.4/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activesupport-5.2.4.4/lib/active_support/lazy_load_hooks.rb:43:in `block in on_load'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activesupport-5.2.4.4/lib/active_support/lazy_load_hooks.rb:42:in `each'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activesupport-5.2.4.4/lib/active_support/lazy_load_hooks.rb:42:in `on_load'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/activejob-5.2.4.4/lib/active_job/railtie.rb:19:in `block in <class:Railtie>'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/railties-5.2.4.4/lib/rails/initializable.rb:32:in `instance_exec'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/railties-5.2.4.4/lib/rails/initializable.rb:32:in `run'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/railties-5.2.4.4/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /home/janek/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
	from /home/janek/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /home/janek/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /home/janek/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /home/janek/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each'
	from /home/janek/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `call'
	from /home/janek/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
	from /home/janek/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
	from /home/janek/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/railties-5.2.4.4/lib/rails/initializable.rb:60:in `run_initializers'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/railties-5.2.4.4/lib/rails/application.rb:361:in `initialize!'
	from /home/janek/rclub/api/config/environment.rb:7:in `<top (required)>'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/application.rb:106:in `preload'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/application.rb:157:in `serve'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/application.rb:145:in `block in run'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/application.rb:139:in `loop'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/application.rb:139:in `run'
	from /home/janek/.rvm/gems/ruby-2.6.6/gems/spring-2.1.1/lib/spring/application/boot.rb:19:in `<top (required)>'
	from /home/janek/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/janek/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from -e:1:in `<main>'

@jan-kaczorowski
Copy link
Author

update:
adding: require 'active_job/queue_adapters/cloudtasker_adapter' here https://github.com/keypup-io/cloudtasker/blob/master/lib/cloudtasker.rb on line 21 right below cloudtasker/worker solves the issue.

@jan-kaczorowski
Copy link
Author

Ignore previous solution. Works but very crude. I can see, the source of the problem is: lib/cloudtasker/engine.rb:15

initializer 'cloudtasker.active_job', after: :load_config_initializers do
  require 'active_job/queue_adapters/cloudtasker_adapter' if defined?(::ActiveJob::Railtie)
end

seems that the code in the block does not really get run

@alachaum
Copy link
Member

@jan-kaczorowski thanks for reporting this. Let me double check on my side the load sequence for Rails 5.

@Fodoj
Copy link

Fodoj commented Dec 16, 2020

Happens on Rails 6 as well

@alachaum
Copy link
Member

@Fodoj Hmmm... I wonder why I didn't get the issue locally. I'll try more autoloading scenarios then.

@alachaum
Copy link
Member

alachaum commented Dec 16, 2020

@Fodoj @jan-kaczorowski

I've created a test repository with two vanilla Rails apps (Rails 5.2 and 6.0) using cloudtasker 0.11.rc2. The initialization process works fine in these apps and the CloudtaskerAdapter gets properly registered.

https://github.com/alachaum/cloudtasker-tests

I've tried them with Ruby 2.5.5 and 2.7.1, with and without bootsnap/spring, with and without eager_load/cache_classes, using application.rb and development.rb. All good.

Are you able to run these examples? Is there anything specific in your apps that could be impacting the Rails initialization sequence?

I'm looking to reproduce the issue first.

@alachaum alachaum added the bug Something isn't working label Dec 16, 2020
@alachaum alachaum self-assigned this Dec 16, 2020
@Fodoj
Copy link

Fodoj commented Dec 16, 2020

@alachaum if it helps with debugging, we had this happening after adding skylight gem, which is also visible in the stacktrace. I understand its a rather specific combination, though:

Caused by:
499
NameError: uninitialized constant ActiveJob::QueueAdapters::CloudtaskerAdapter
500
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/active_support.rb:61:in `block in load_missing_constant'
501
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in `allow_bootsnap_retry'
502
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `load_missing_constant'
503
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activejob-6.0.3.3/lib/active_job/queue_adapters.rb:133:in `const_get'
504
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activejob-6.0.3.3/lib/active_job/queue_adapters.rb:133:in `lookup'
505
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activejob-6.0.3.3/lib/active_job/queue_adapter.rb:37:in `queue_adapter='
506
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activejob-6.0.3.3/lib/active_job/railtie.rb:30:in `block (3 levels) in <class:Railtie>'
507
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activejob-6.0.3.3/lib/active_job/railtie.rb:28:in `each'
508
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activejob-6.0.3.3/lib/active_job/railtie.rb:28:in `block (2 levels) in <class:Railtie>'
509
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
510
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
511
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
512
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
513
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
514
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/lazy_load_hooks.rb:51:in `each'
515
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
516
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activejob-6.0.3.3/lib/active_job/base.rb:74:in `<class:Base>'
517
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activejob-6.0.3.3/lib/active_job/base.rb:61:in `<module:ActiveJob>'
518
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/activejob-6.0.3.3/lib/active_job/base.rb:15:in `<main>'
519
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
520
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
521
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
522
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
523
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
524
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/probes.rb:118:in `require'
525
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/zeitwerk-2.4.1/lib/zeitwerk/kernel.rb:33:in `require'
526
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/util/inflector.rb:42:in `const_get'
527
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/util/inflector.rb:42:in `block in constantize'
528
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/util/inflector.rb:38:in `each'
529
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/util/inflector.rb:38:in `inject'
530
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/util/inflector.rb:38:in `constantize'
531
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/util/inflector.rb:83:in `safe_constantize'
532
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/probes.rb:61:in `available?'
533
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/probes.rb:67:in `register'
534
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/probes/active_job_enqueue.rb:44:in `<module:Probes>'
535
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/probes/active_job_enqueue.rb:2:in `<module:Core>'
536
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/probes/active_job_enqueue.rb:1:in `<main>'
537
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
538
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
539
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
540
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
541
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
542
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/probes.rb:118:in `require'
543
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/zeitwerk-2.4.1/lib/zeitwerk/kernel.rb:33:in `require'
544
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/probes.rb:48:in `block in probe'
545
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/probes.rb:47:in `each'
546
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/probes.rb:47:in `probe'
547
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/railtie.rb:132:in `load_probes'
548
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/railtie.rb:33:in `run_initializer'
549
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-4.3.2/lib/skylight/railtie.rb:31:in `block in <class:Railtie>'
550
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:32:in `instance_exec'
551
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:32:in `run'
552
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:61:in `block in run_initializers'
553
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:60:in `run_initializers'
554
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/railties-6.0.3.3/lib/rails/application.rb:363:in `initialize!'
555
/opt/app-root/src/config/environment.rb:6:in `<main>'
556
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
557
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
558
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
559
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
560
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
561
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/skylight-core-4.3.2/lib/skylight/core/probes.rb:118:in `require'
562
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/zeitwerk-2.4.1/lib/zeitwerk/kernel.rb:33:in `require'
563
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/railties-6.0.3.3/lib/rails/application.rb:339:in `require_environment!'
564
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/railties-6.0.3.3/lib/rails/application.rb:523:in `block in run_tasks_blocks'
565
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/sprockets-rails-3.2.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
566
/opt/app-root/bundle/ruby/2.7.0/ruby/2.7.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
567
/usr/lib/fullstaq-ruby/versions/2.7-jemalloc/bin/bundle:23:in `load'
568
/usr/lib/fullstaq-ruby/versions/2.7-jemalloc/bin/bundle:23:in `<main>'

@Fodoj
Copy link

Fodoj commented Dec 16, 2020

Error rises during execution of this commands (cloudtasker is not part of specific group in Gemfile, skylight is included in production only):

bundle install --without test development --deployment --jobs 16 && \
bundle clean

@alachaum
Copy link
Member

@Fodoj thanks for the details, I'll try on my side.

@benbonnet
Copy link

had the same issue (rails 6, ruby 2.6)

Solved this by having a look at your test repo. you're using 0.11.rc2

By default (simply using gem 'cloudtasker'), 0.10.1 is installed

@alachaum
Copy link
Member

alachaum commented Dec 25, 2020

@benbonnet that's right, the ActiveJob adapter is not yet available in the mainstream version. Need to point to release candidates.

@jan-kaczorowski @Fodoj I've made a few adjustments to the initialization process, tested it with the skylight gem and published a new version. Would you be able to update your cloudtasker version to 0.11.rc3 and let me know how it looks on your end?

@jan-kaczorowski
Copy link
Author

@alachaum I did a little checking and testing and it seems 0.11.rc3 runs without issues.

Question: Are there any plans to integrate Google Cloud Scheduler to be cron operator instead of redis?

@alachaum
Copy link
Member

@jan-kaczorowski Great! I'm going to close this issue then and prepare an official release for 0.11.

Regarding Cloud Scheduler, I've raised an issue to track this feature: #20

@benbonnet
Copy link

benbonnet commented Jan 28, 2022

sorry to dig out this issue; this active job part is not yet obvious.

I'm completely unable to have cloudtasker working through active job in production : nothing fails, but nothing happens.

In development (using ngrok with config.mode = :production), job sent via active job get executed, but things remain local (not going through cloud tasks as it does using workers)

Is it the expected behaviour ?
Is redis a requirement in production once you want to use cloudtasker's activejob ?

@alachaum
Copy link
Member

alachaum commented Jan 31, 2022

@benbonnet that's surprising. Are you able to make the Rails example work locally with ngrok?

Redis is only required for the extensions (unique job, cron and batch), which anyway are not compatible with ActiveJob. So you shouldn't require them and therefore you do not need Redis.

When you say:

In development (using ngrok with config.mode = :production), job sent via active job get executed, but things remain local (not going through cloud tasks as it does using workers)

It sounds odd to me. The jobs should go via Cloud Tasks if you set config.mode = :production and a config.processor_host matching your ngrok endpoint.
Are you sure to have config.active_job.queue_adapter = :cloudtasker set in your application.rb or development.rb

Here is a list of points to double check:

  • Cloudtasker config: config.mode = :production
  • Cloudtasker config: config.processor_host = <external endpoint reachable from Cloud Tasks>
  • Authentication: setup authentication locally or setup authentication for production (not required if you deploy on Cloud Run)
  • ActiveJob config: Make sure config.active_job.queue_adapter = :cloudtasker is set in application.rb or development|production.rb. If set in application.rb, make sure it is not overridden in development|production.rb

Out of curiosity, which platform/service do you deploy to? Is it Cloud Run?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants