diff --git a/src/backend/base/langflow/custom/custom_component/custom_component.py b/src/backend/base/langflow/custom/custom_component/custom_component.py index 9e790d708250..88ec6cdc600b 100644 --- a/src/backend/base/langflow/custom/custom_component/custom_component.py +++ b/src/backend/base/langflow/custom/custom_component/custom_component.py @@ -185,7 +185,7 @@ def graph(self): @property def user_id(self): - if hasattr(self, "_user_id"): + if hasattr(self, "_user_id") and self._user_id: return self._user_id return self.graph.user_id @@ -477,7 +477,7 @@ async def load_flow(self, flow_id: str, tweaks: dict | None = None) -> Graph: if not self.user_id: msg = "Session is invalid" raise ValueError(msg) - return await load_flow(user_id=str(self._user_id), flow_id=flow_id, tweaks=tweaks) + return await load_flow(user_id=str(self.user_id), flow_id=flow_id, tweaks=tweaks) async def run_flow( self, @@ -493,7 +493,7 @@ async def run_flow( flow_id=flow_id, flow_name=flow_name, tweaks=tweaks, - user_id=str(self._user_id), + user_id=str(self.user_id), run_id=self.graph.run_id, ) @@ -502,7 +502,7 @@ def list_flows(self) -> list[Data]: msg = "Session is invalid" raise ValueError(msg) try: - return list_flows(user_id=str(self._user_id)) + return list_flows(user_id=str(self.user_id)) except Exception as e: msg = f"Error listing flows: {e}" raise ValueError(msg) from e