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
Describe the bug
Chainlit requires sticky sessions when hosted behind a cluster. Many Kubernetes Ingress solutions leverage cookies for sticky sessions.
When leveraging Chainlit's Copilot feature, cookies are not sent along during the initial setup of the websocket causing the Copilot widget to fail with an error of Could not reach the server..
When inspecting the network track you will see POSTs being sent to https://{chainlit_server_url}/ws/socket.io/?EIO=4&transport=polling&t={##}&sid={##} and receiving a http 400 BAD REQUEST with the response being Invalid session {###}. Response from the server can be seen using Set-Cookie however requests being made from the Copilot code do not send the cookie.
While using Chainlit's UI directly everything works as expected.
To Reproduce
Steps to reproduce the behavior:
Run a Chainlit application in a Kubernetes deployment with multiple replicas
Enable Ingress with cookie based sticky sessions
Configure a second site to load Chainlit Copilot
Expected behavior
When the Chainlit Copilot widget reaches out to the Chainlit server it should pass cookies that have been set in the session.
Screenshots
n/a
Desktop (please complete the following information):
OS: Windows and MacOS
Browser: All (observed on Edge and Chrome)
Version: n/a
Smartphone (please complete the following information):
n/a
Hi, is there any update on this issue? I'm experiencing the same problem where cookies are not being set in the request headers.
Upon investigation, I found that after enabling cookies, we also need to set withCredentials: true in the Socket.IO client configuration to include cookies in the request headers.
Starting with version 4.7.0, when setting the withCredentials option to true, the Node.js client will now include the cookies in the HTTP requests, making it easier to use it with cookie-based sticky sessions.
In Chainlit's react-client code, it appears that the withCredentials: true parameter is missing in the Socket.IO client setup: useChatSession.ts#L103. Adding this might resolve the issue for cookie-based sticky sessions.
Describe the bug
Chainlit requires sticky sessions when hosted behind a cluster. Many Kubernetes Ingress solutions leverage cookies for sticky sessions.
When leveraging Chainlit's Copilot feature, cookies are not sent along during the initial setup of the websocket causing the Copilot widget to fail with an error of
Could not reach the server.
.When inspecting the network track you will see POSTs being sent to
https://{chainlit_server_url}/ws/socket.io/?EIO=4&transport=polling&t={##}&sid={##}
and receiving a http 400 BAD REQUEST with the response beingInvalid session {###}
. Response from the server can be seen usingSet-Cookie
however requests being made from the Copilot code do not send the cookie.While using Chainlit's UI directly everything works as expected.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
When the Chainlit Copilot widget reaches out to the Chainlit server it should pass cookies that have been set in the session.
Screenshots
n/a
Desktop (please complete the following information):
Smartphone (please complete the following information):
n/a
Additional context
Consider using withCredentials to resolve this issue.
The text was updated successfully, but these errors were encountered: