Comments (11)
just to be clear/explicit: because Cloudtasker::WorkerController
is not subclassing Cloudtasker::ApplicationController
, the former is not having the skip_before_action :verify_authenticity_token
(from the latter) leading to the ActionController::InvalidAuthenticityToken
error
edit: also this only happens in development environment, eg in production because of eager loading the Cloudtasker::ApplicationController
is loaded.
from cloudtasker.
@eLod thanks for raising this issue. It looks weird to me that Cloudtasker::WorkerController
is not inheriting Cloudtasker::ApplicationController
in your context. Could you provide a minimal example on a repo which mimics your setup? I'll do some checks on my side as well.
from cloudtasker.
well, i just checked, with a bare new rails app, only change is adding the cloudtasker gem:
with rails 5
% rails c
Running via Spring preloader in process 32560
Loading development environment (Rails 5.2.6)
irb(main):001:0> ApplicationController
=> ApplicationController
irb(main):002:0> Cloudtasker::WorkerController.ancestors.include?(Cloudtasker::ApplicationController)
=> false
with rails6
% rails c
Running via Spring preloader in process 32564
Loading development environment (Rails 6.0.4)
irb(main):001:0> ApplicationController
=> ApplicationController
irb(main):002:0> Cloudtasker::WorkerController.ancestors.include?(Cloudtasker::ApplicationController)
=> true
from cloudtasker.
upon further checking it seems our active admin & devise & devise_authy initialization process is causing the ApplicationController
to be loaded and causing the problem. i still think it's worth it to fix it in this library, but the fix is trivial (and the problem does not seem to affect rails 6), plus i am not sure how much of legacy code in our application is causing the problem, so feel free to close this issue.
from cloudtasker.
well, its active_admin and devise, the routes include something like devise_for :users, ActiveAdmin::Devise.config
, where ActiveAdmin::Devise
refers to ::Devise::SessionsController
which subclasses Devise.parent_controller.constantize
through DeviseController
, which in turn is simply ApplicationController
.
i can confirm, with the bare new rails app, adding activeadmin and devise latest versions, and placing ActiveAdmin::Devise.config
inside config/routes.rb
rails5
% rails c
Running via Spring preloader in process 36686
Loading development environment (Rails 5.2.6)
irb(main):001:0> Cloudtasker::WorkerController.ancestors.include?(Cloudtasker::ApplicationController)
=> false
rails6
% rails c
Running via Spring preloader in process 36962
Loading development environment (Rails 6.0.4)
irb(main):001:0> Cloudtasker::WorkerController.ancestors.include?(Cloudtasker::ApplicationController)
=> true
from cloudtasker.
oh i just found, most likely this somewhat cryptic pr #36 is trying to solve the same issue
from cloudtasker.
Going to do more testing on my side. Looks like PR #36 is the way to go in the end.
from cloudtasker.
i really feel #36 is the wrong "solution", it keeps subclassing ::ApplicationController
(while Cloudtasker::ApplicationController
becomes unused) which can introduce other problems in turn. i would suggest to simply correct the namespacing (or drop rails 5.2 support, or somehow note the problem, like in readme).
from cloudtasker.
I'll rewrite this PR. We can just get rid of ApplicationController I suppose - it's fairly useless.
from cloudtasker.
sure that is also a solution, most likely the best one
from cloudtasker.
This issue has been fixed in the following releases:
v0.9.5
v0.10.2
v0.11.1
v0.12.1
from cloudtasker.
Related Issues (20)
- SSL on Cloudtasker Local Server
- Question: configure processor_host via environment variable HOT 5
- Batch callback that fires only when all children complete successfully
- Odd error on boot HOT 3
- default isn't the only default queue if using active job HOT 1
- TypeError: wrong argument type Symbol (expected String) HOT 6
- Inconsistent executions count with ActiveJob.retry_on HOT 7
- Configure a specific processor_host for Cloudtasker::Cron::Schedule HOT 3
- grpc cannot be used before and after forking with `deliver_later` HOT 5
- Cloudtasker::Cron::Schedule crash application load when schedule tasks due date is 720 hours in the future HOT 2
- Remove `google-gax` dependency. HOT 3
- Post-install message from google-gax HOT 4
- Cloudtasker::Cron::Schedule trying to access wrong project and queue - not respecting initializer configuration HOT 4
- [Question/docs] How is the GCP project id retrieved when running on GCP? HOT 3
- Make Queue Prefix not necessary HOT 1
- Question: What would be the best way to push thousands of jobs at once? HOT 2
- Getting a cryptic error on boot HOT 3
- Force the job_id for ActiveJob
- Protobuf serialization errors: ArgumentError (Value 600 must be a Hash or a Google::Protobuf::Duration) HOT 7
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 cloudtasker.