Scheduled jobs logs not appearing
I'm using console.log inside an action which I run by scheduling. I don't see any print statement in the Convex log section in the Dashboard, is it normal?
7 Replies
Hello! Logs for scheduled jobs should appear on the logs page. Couple questions: are you looking at the logs page for the correct deployment (prod/dev/preview)? When you schedule a job, does it show up on the “Schedules” page?
are you looking at the logs page for the correct deployment (prod/dev/preview)?yes
When you schedule a job, does it show up on the “Schedules” page?I see it empty, maybe because I schedule it to run after 0 seconds so it already happened?
Got it, thanks for confirming. Yeah, if your function is scheduled to run right away, you might not see it show up on the schedules page. On the logs page, do you see logs marking that the function was successful or failed? Those should show up regardless of if you have any
console.log
calls or not
If you're still having trouble, I'd recommend adding more logs in your codepath and running the function manually through the function runner in the dashboard, with the logs page open so you can see what happens!In the log section I see that the call to the scheduled action has been made succesfully. I have put a log statement at the top of the function but I still do not see it. If you want I can share more details of my code in dm
it seems like nothing is happening inside the action...
Yes feel free to dm me some code snippets!
done!
For discoverability - We discussed in DMs and discovered the issue was the scheduled function was attempting to check the user identity. However, the user identity is not automatically passed to scheduled functions. Recommended solution was to make the scheduled action an
internalAction
and refactor to pass the identity as an argument to the action.