You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We would expect the current_user to exist in the channel subscribed and unsubscribed method.
What actually happened?
The user deserialization fails because the GlobalID::Locate command happens in the current tenant, but the serialization of the object to a globalid happens outside of the tenant. This causes a user in the Acme tenant to be serialized in the default tenant, and then it's not locatable when the channel tries to identify it.
You can test this by setting GlobalID.app to the current tenant before serialization / deserialization.
GlobalID.app=Apartment::Tenant.current
We have been able to work around this by setting the identifier to a gid_param, which is then magically rehydrated by AnyCable but that's very unexpected behavior.
The other issue with doing that is that when we use the redis adapter in tests and dev mode, the tests fail because ActionCable doesn't rehydrate globalids automatically when loading the identifiers like AnyCable does.
The text was updated successfully, but these errors were encountered:
Tell us about your environment
Ruby version: 3.1.2
anycable
gem version: 1.2.5anycable-rails
gem version: 1.3.5grpc
gem version: 1.52.0What did you do?
We're following the guidance for multi-tenancy from the anycable.io site but we're seeing the tenant get lost when the objects are serialized.
Our GlobalID configuration takes the current tenant into account. So, if you call:
It would return
gid://acme/User/1
Here is a simplified version of what we're doing:
What did you expect to happen?
We would expect the current_user to exist in the channel subscribed and unsubscribed method.
What actually happened?
The user deserialization fails because the GlobalID::Locate command happens in the current tenant, but the serialization of the object to a globalid happens outside of the tenant. This causes a user in the Acme tenant to be serialized in the default tenant, and then it's not locatable when the channel tries to identify it.
You can test this by setting GlobalID.app to the current tenant before serialization / deserialization.
We have been able to work around this by setting the identifier to a gid_param, which is then magically rehydrated by AnyCable but that's very unexpected behavior.
The other issue with doing that is that when we use the
redis
adapter in tests and dev mode, the tests fail because ActionCable doesn't rehydrate globalids automatically when loading the identifiers like AnyCable does.The text was updated successfully, but these errors were encountered: