Fetch runs out after a minute in my "use node" action

"use node";
import { api } from "./_generated/api";
export async function generateAndUploadVideo(ctx,auth,title,script,tags){
let url = process.env.MOVIEAPI_URL+"/generate";
if(auth == null){
return;
}
let videoResponse = await fetch(url,{
method:"POST",
body:JSON.stringify({
"script":script
}),
keepalive:true
});//This line always times out at a minute
let video = await videoResponse.blob();
const storageId = await ctx.storage.store(video);
await ctx.runMutation(api.video.storeVideo,{
video:storageId,
title:title,
creator:auth,
tags:tags
});

await ctx.runAction(api.googleActions.uploadToYoutube,{
video:storageId,
title:title,
user:auth,
tags:tags
});

}
"use node";
import { api } from "./_generated/api";
export async function generateAndUploadVideo(ctx,auth,title,script,tags){
let url = process.env.MOVIEAPI_URL+"/generate";
if(auth == null){
return;
}
let videoResponse = await fetch(url,{
method:"POST",
body:JSON.stringify({
"script":script
}),
keepalive:true
});//This line always times out at a minute
let video = await videoResponse.blob();
const storageId = await ctx.storage.store(video);
await ctx.runMutation(api.video.storeVideo,{
video:storageId,
title:title,
creator:auth,
tags:tags
});

await ctx.runAction(api.googleActions.uploadToYoutube,{
video:storageId,
title:title,
user:auth,
tags:tags
});

}
The fetch in this function always times out at 60 seconds.
6 Replies
Convex Bot
Convex Bot2mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
coochie boy sniped you
even when the code is directly in a "use node" action in a seperate file, it still times out i might try seperating it into an "use node" action in a seperate file again but i dont think thats the issue
coochie boy sniped you
heres the timeout
No description
coochie boy sniped you
ignore the error thats my other function. without that error function its still 60 seconds
erquhart
erquhart2mo ago
The action won’t timeout that soon on its own. I would do some logging in the action to determine where it’s failing and go from there. Maybe an api silent failure.
coochie boy sniped you
thank u i will check my api I tried fetching with postman and it doesnt timeout there nvm its just github codespaces it does timeout on postman as well

Did you find this page helpful?