I currently port over some code to Nextjs Server Actions. I have a Frontend Form that submits a file, I wanna upload that file to my 3rd party API. But the request takes over 4 Minutes before it probably times out.
export async function uploadDocument(formData: FormData) {
const projectId = z.string().parse(formData.get("projectId"));
const file = formData.get("file") as File;
const bearer = await getBearer();
try {
await fetch(
`https://apiurl.com/Project/${projectId}/container/${file.name}`,
{
method: "POST",
body: formData,
credentials: "include",
headers: {
Authorization: `Bearer ${bearer}`,
},
},
);
revalidatePath(`/project/${projectId}/documents`);
return { ok: true };
} catch (e) {
console.log(e);
return { ok: false };
}
}
I get no errors. Any idea what causes it?