SOLVED Scheduled Function not running....?
The scheduled function FUNCTION_161968 of my project goodvibes-474a9a works perfectly when I run it with "Try", but only works intermittently as a scheduled function. I can't seem to understand/predict when / how / why it works sometimes or not.
@daniel-mulroy please check the detected time zone. Also try to schedule it 1h later. Because of timezone calculation it could end up being scheduled at gmt+0 00:00 and so never been triggered, or even change it to be runned at non zero minute (01:03 for eg)
Interesting. I have changed it to run at 2:05 AM, but here was the previous configuration, FYI. We will see if it starts working again Thanks!
@jbenguira Sorry to report, I have removed "Require API Key" and set the recurrence to every 5 minutes, it is still not working.
It says there are 172 executions today, which means it is probably running every 5 minutes... but the result of the function is not happening.
Is there any difference in the execution environment between clicking "try" and running via Scheduler?
Joseph Benguira last edited by Joseph Benguira
@daniel-mulroy so the execution count indicate that the function is indeed executed
I don't know what you are doing in the function, but I guess it could be a difference based on ENV vars or global vars?
Solved... and I think I know why, very edge case
I had a callback at the very end of my function handler, after a bunch of async/await stuff.
Lambda has a context object:
From their docs:
"Set to false to send the response right away when the callback runs, instead of waiting for the Node.js event loop to be empty. If this is false, any outstanding events continue to run during the next invocation."
Anyway, removing the callback at the end of the function worked. I think lambda was executing the callback without waiting for the inner await'd functions to finish, which killed the running processes and prevented the updates from happening.
Does "Try" run with a different context object than a scheduled function?