I have a function executed like this
Map<String, dynamic> data = {
"followerId": state.user!.$id,
"followerName": state.profile!.name,
"followerUserName": state.profile!.username,
"followeeId": otherUserId
};
String body = jsonEncode(data);
await functions.createExecution(
functionId: appwriteConsts.functions.onFollowUser,
body: body,
xasync: true,
scheduledAt: scheduleFor.toUtc().toIso8601String(),
);
Upon execution, checking my Appwrite Cloud console, I see that the body is not there? Is this a bug, an unimplemented feature or there's something I'm not doing well?
Anyone here?
I have the same result when I try to execute the same function from the console
looking through the source, there is a good possibility that the body is not sent. let me confirm this from my side.
Why does that happen?
I am yet to confirm this, but if it indeed isn't sending the body, it was mostly a mistake.
Alright. I'll be awaiting the result of your confirmation
@Meldiron I don't think we are setting the body to scheduled executions.
I did a print_r($schedule)
in the ScheduleExecutions
, the data
is missing. Pretty sure we should be sending the body to the scheduler.
It should be available in the schedules
collection document iirc.
Execution document is not supposed to have the body, and schedule document yes. Checking the logic here: https://github.com/appwrite/appwrite/blob/c58fa78962a1356d5dec11de326dc011bda59357/app/controllers/api/functions.php#L1934 All seems as intended. Ill try to quickly reproduce the bug now
yupp, data is saved successfully. probably just not sent to the scheduler. or is this wrong?
$schedule['data']['*']
the doc doesn't seem to contain the data
object at all. I couldn't see atleast.
@Meldiron we probably just need below in $getSchedule
?
'data' => $schedule->getAttribute('data'),
Sounds correct. Ill reach out to Christy to see why it was not there in the first place, maybe it was intentional for other type of schedules
possibly yep. we could do a check though. but lets wait for christy
@Samuel Kings good news, I managed to reproduce it and @darShan 's bug suspicison seems very correct. Ill work on a fix, and also ensure the behaviour with a newly added test to make sure this never happens again.
also, the keys wouldn't make sense if the schedule is after 15 mins no?
You mean dynamic API keys? Those are only generated on function's worker, so right before execution (just when scheduledAt hits)
- nope, i issued a scheduled function to execute after 2 hours, i see -
x-appwrite-key
in the recd. scheduled doc. - also
jwt
let me ping you with more details. this discussion is just blocking the thread.
Alright. Glad to hear this ☺️ Thanks guys
Please when can we expect a fix?
Friday releases are always scarry, so you can expect a fix next week. Ill keep this at the top of my todo list, to make sure it's finished asap, and Ill propose deployment the same day
Alright then. Thanks
Hi @Meldiron Please what is the status of this?
A PR has been created and validated, but since the team is away rn, you can expect the fix landing around early next week, possibly sooner too.
Recommended threads
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- Our Appwrite organization is suspended
Please give support regarding this , no app is working now , please solve my issue and give support , no one is replying in message section or email.
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...