mirror of https://github.com/kortix-ai/suna.git
ensure sandbox active
This commit is contained in:
parent
ee35732e7e
commit
5617f5e06d
|
@ -183,52 +183,52 @@ export const getProject = async (projectId: string): Promise<Project> => {
|
||||||
|
|
||||||
console.log('Raw project data from database:', data);
|
console.log('Raw project data from database:', data);
|
||||||
|
|
||||||
// // If project has a sandbox, ensure it's started
|
// If project has a sandbox, ensure it's started
|
||||||
// if (data.sandbox?.id) {
|
if (data.sandbox?.id) {
|
||||||
// // Fire off sandbox activation without blocking
|
// Fire off sandbox activation without blocking
|
||||||
// const ensureSandboxActive = async () => {
|
const ensureSandboxActive = async () => {
|
||||||
// try {
|
try {
|
||||||
// const {
|
const {
|
||||||
// data: { session },
|
data: { session },
|
||||||
// } = await supabase.auth.getSession();
|
} = await supabase.auth.getSession();
|
||||||
|
|
||||||
// // For public projects, we don't need authentication
|
// For public projects, we don't need authentication
|
||||||
// const headers: Record<string, string> = {
|
const headers: Record<string, string> = {
|
||||||
// 'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
// };
|
};
|
||||||
|
|
||||||
// if (session?.access_token) {
|
if (session?.access_token) {
|
||||||
// headers['Authorization'] = `Bearer ${session.access_token}`;
|
headers['Authorization'] = `Bearer ${session.access_token}`;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// console.log(`Ensuring sandbox is active for project ${projectId}...`);
|
console.log(`Ensuring sandbox is active for project ${projectId}...`);
|
||||||
// const response = await fetch(
|
const response = await fetch(
|
||||||
// `${API_URL}/project/${projectId}/sandbox/ensure-active`,
|
`${API_URL}/project/${projectId}/sandbox/ensure-active`,
|
||||||
// {
|
{
|
||||||
// method: 'POST',
|
method: 'POST',
|
||||||
// headers,
|
headers,
|
||||||
// },
|
},
|
||||||
// );
|
);
|
||||||
|
|
||||||
// if (!response.ok) {
|
if (!response.ok) {
|
||||||
// const errorText = await response
|
const errorText = await response
|
||||||
// .text()
|
.text()
|
||||||
// .catch(() => 'No error details available');
|
.catch(() => 'No error details available');
|
||||||
// console.warn(
|
console.warn(
|
||||||
// `Failed to ensure sandbox is active: ${response.status} ${response.statusText}`,
|
`Failed to ensure sandbox is active: ${response.status} ${response.statusText}`,
|
||||||
// errorText,
|
errorText,
|
||||||
// );
|
);
|
||||||
// } else {
|
} else {
|
||||||
// console.log('Sandbox activation successful');
|
console.log('Sandbox activation successful');
|
||||||
// }
|
}
|
||||||
// } catch (sandboxError) {
|
} catch (sandboxError) {
|
||||||
// console.warn('Failed to ensure sandbox is active:', sandboxError);
|
console.warn('Failed to ensure sandbox is active:', sandboxError);
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
|
|
||||||
// // Start the sandbox activation without awaiting
|
// Start the sandbox activation without awaiting
|
||||||
// ensureSandboxActive();
|
ensureSandboxActive();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Map database fields to our Project type
|
// Map database fields to our Project type
|
||||||
const mappedProject: Project = {
|
const mappedProject: Project = {
|
||||||
|
|
Loading…
Reference in New Issue