Closed GabrielDealca closed 10 months ago
Your connection object is None. So I'd guess the way you're passing config to k8s isn't working. (Did your environment variables not load?)
This isn't a channels issue really sorry.
Your connection object is None. So I'd guess the way you're passing config to k8s isn't working. (Did your environment variables not load?)
This isn't a channels issue really sorry.
Thank you for replying, my env variables are purely hard coded and not passed to env variables for the sake of testing this, so you think there is a problem with my CHANNEL_LAYERS config? though I use channels_redis there for the backend, so this might be an issue on the wrong repo?
if you don't mind, could you provide the code for your consumer?
if you don't mind, could you provide the code for your consumer?
The errors already occur with the 1 line of code I provided, but similar error to this consumer class as well
class ThisConsumer(AsyncWebsocketConsumer):
async def connect(self):
self.user = self.scope['user']
self.group_name = f'user_{self.user.id}'
await self.channel_layer.group_add(self.group_name, self.channel_name) # error occurs here
await self.accept()
if you don't mind, could you provide the code for your consumer?
The errors already occur with the 1 line of code I provided, but similar error to this consumer class as well
class ThisConsumer(AsyncWebsocketConsumer): async def connect(self): self.user = self.scope['user'] self.group_name = f'user_{self.user.id}' await self.channel_layer.group_add(self.group_name, self.channel_name) # error occurs here await self.accept()
Everything here seems to be fine...
Errror only occurs on when deployed to Kuberentes.
The error will be with the deployment, not with the Channels code.
Errror only occurs on when deployed to Kuberentes.
The error will be with the deployment, not with the Channels code.
Can you please expound on this? What's the difference in terms of setup locally versus deployment to make this work?
This line causes the error
async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})
I checked channel_layer, it is not empty or not None, so I don't understand what is the NoneType pertaining to. I am using Django channels Daphne connected to Redis Memorystore. I tested connection to redis memorystore using the redis library, and it is accessible, so I don't think communication with the backend is the problem(?).
Have been stuck with this issue for almost a week now. Any help would be very much appreciated.