From 76163f6cc354dfbf5fd9ccc2db93958933ca1aca Mon Sep 17 00:00:00 2001 From: Adam Cohen Hillel Date: Fri, 18 Apr 2025 14:50:06 +0100 Subject: [PATCH] fix backend but vnc url is still broken --- backend/agent/api.py | 4 ++-- backend/api.py | 6 +++--- frontend/src/lib/api.ts | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/backend/agent/api.py b/backend/agent/api.py index 6ab8891f..edb54c35 100644 --- a/backend/agent/api.py +++ b/backend/agent/api.py @@ -285,8 +285,8 @@ async def start_agent(thread_id: str, user_id: str = Depends(get_current_user_id 'sandbox': { 'id': sandbox_id, 'pass': sandbox_pass, - 'vnc_preview': sandbox.get_preview_link(6080), - 'sandbox_url': sandbox.get_preview_link(8080) + 'vnc_preview': str(sandbox.get_preview_link(6080)), + 'sandbox_url': str(sandbox.get_preview_link(8080)) } }).eq('project_id', project_id).execute() diff --git a/backend/api.py b/backend/api.py index 42da48b8..f8fcc935 100644 --- a/backend/api.py +++ b/backend/api.py @@ -56,10 +56,10 @@ app = FastAPI(lifespan=lifespan) app.add_middleware( CORSMiddleware, - allow_origins=["*"], + allow_origins=["https://www.suna.so", "https://suna.so", "http://localhost:3000"], allow_credentials=True, - allow_methods=["*"], - allow_headers=["*"], + allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"], + allow_headers=["Content-Type", "Authorization"], ) # Include the agent router with a prefix diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 9bfff556..42e744a9 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -454,6 +454,7 @@ export const startAgent = async (threadId: string): Promise<{ agent_run_id: stri 'Content-Type': 'application/json', 'Authorization': `Bearer ${session.access_token}`, }, + credentials: 'include', }); if (!response.ok) { @@ -519,6 +520,7 @@ export const getAgentStatus = async (agentRunId: string): Promise => { headers: { 'Authorization': `Bearer ${session.access_token}`, }, + credentials: 'include', }); if (!response.ok) { @@ -562,6 +564,7 @@ export const getAgentRuns = async (threadId: string): Promise => { headers: { 'Authorization': `Bearer ${session.access_token}`, }, + credentials: 'include', }); if (!response.ok) {