#Transient error while running schedule error
3 messages · Page 1 of 1 (latest)
Based on the error message and code you've provided, it appears you're encountering a "Transient error while running schedule" when trying to schedule a mutation. The error message showing HTML content (a 404 page) suggests there might be an issue with how the function is being referenced.
Looking at your code, I notice you're scheduling internal.emotionAnalysis.mutations.createOrUpdateAnalysisInternal, but the mutation you've shown is named createOrUpdateAnalysis (without the "Internal" suffix). This mismatch could be causing the 404 error.
According to the Best Practices documentation, when using ctx.scheduler, you should schedule internal functions. Here's what you need to do:
- Create an internal mutation with the correct name that matches your scheduler call:
export const createOrUpdateAnalysisInternal = internalMutation({
args: {
clerkId: v.string(),
entryId: v.id("entries"),
anxietyConfidence: v.number(),
// ... rest of your args
},
handler: async (ctx, args) => {
// Your existing handler logic here
},
});
- Verify the file path matches your scheduler call. If you're calling
internal.emotionAnalysis.mutations.createOrUpdateAnalysisInternal, make sure:- The file is at
convex/emotionAnalysis/mutations.ts, OR - Update your scheduler call to match the actual file location
- The file is at
According to the Scheduled Functions documentation, the standard pattern for scheduling immediately (with delay 0) from a mutation is commonly used to trigger actions or other mutations conditionally based on the mutation succeeding.