-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Can't make AnyCable work with Devise in development #127
Comments
Do you set secret_key_base explicitly for development env? See this issue: #125 That could be the reason.
This has been fixed in master, try |
Hey @palkan , thank you very much for your answer and time. I'm sorry I didn't respond earlier; it's been a busy week!
Please let me know if there's anything else I can do to help. |
Oh, I didn't notice the link to the reproduction repo in the description. Will check soon! |
With anycable-rails 1.0.0 you can fetch user in one line
|
OK, I checked the app, and found the following. First, it didn't work for me at all and raised Then I tried to run it with master version of both This version works fine: def connect
user_id = cookies.encrypted[:user_id]
return reject_unauthorized_connection if user_id.nil?
user = User.find_by(id: user_id)
return reject_unauthorized_connection if user.nil?
self.current_user = user
end The canonical version from the docs also works fine: def connect
self.current_user = env["warden"].user(:user) || reject_unauthorized_connection
end You had
This one was fixed in 24607a3 The changes I made to the app code (except from disabling some gems):
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
- config.session_store :cache_store
+ config.session_store :cookie_store, key: '_any_session'
|
@davidalejandroaguilar Have you figure this out? |
Hey @palkan , thanks for checking the review app. I really appreciate your efforts here! Week's still crazy so that's why my response is delayed, apologies for that. Few comments on the sample app:
Other than that, yep, that line fixes it! 🎉 . It makes sense now that both processes would need the cookie. config.session_store :cookie_store, key: '_any_session' I guess then Stimulus Reflex is not compatible with AnyCable? I had that set up per their docs:
I'm going to close this issue now. Thank you again for your time and patience on this. Hopefully deployment will go smoothly now! 🤞 |
AnyCable is compatible with Stimulus Reflex. Though it won't work with memory store, 'cause it's not distributed, i.e., lives within a particular process. But with AnyCable you have two processes. Hence, you need a distributed cache, such as Redis Cache Store (and I tried it with the repro app — worked fine). |
I've been trying to make this work all day. Sorry if I missed anything, my brain melted now.
Tell us about your environment
Ruby
version:2.7.1
Rails
version:Rails 6.0.3.1
anycable
gem version:1.0.0.preview2
anycable-rails
gem version:1.0.0.preview2
grpc
gem version:1.28.0
stimulus_reflex
gem version3.2.1
anycable-go
version1.0.0.preview1-5ff1003
What did you do?
User
record../bin/webpack-dev-server
rails s
bundle exec anycable
anycable-go --host=localhost --port=3334
I'm following these basic steps / configurations:
cable.yml
anycable.yml
development.rb
cache_store
is needed for Stimulus Reflex.Warden::Manager
middleware:Source
Connection
in various ways, none of them work:Works with ActionCable, raises
uncaught throw :warden
with AnyCable.Source
Raises
undefined method loaded? for nil:NilClass
.Source
Also these didn't work.
RPC server shows
instance of IO needed
Source
raises
uncaught throw :warden
What did you expect to happen?
What actually happened?
Connection
section".Any help would be greatly appreciated.
Referencing this issue here just because it's a good collaboration bridge between Stimulus Reflex and AnyCable.
The text was updated successfully, but these errors were encountered: