ctx.invokeFunction Not working

Issue Description: What’s happening?

When I run ctx.invokeFunction from a trigger.create after function, it does not invoke the task it should be invoking.

Reproduce the Issue: What steps can someone take to replicate the problem?

  1. Create a File.create after trigger function.
  2. Add ctx.invokeFunction to run another task function on upload, that passes the json from the file.
  3. upload Large JSON file.

Expected Behavior: What did you expect to happen?

The Task I’m invoking should be invoked with the variables I set.

Actual Behavior: What actually happened?

The task never runs

More details or screenshot

Here’s my code in the File.Create after trigger after I parse the JSON from the url:

console.log("running: UPDATE_AI_REPORTS");
console.log("json");
console.log(json);
await ctx.invokeFunction(
  "UPDATE_AI_REPORTS",
  { data: { json } },
  {
    waitForResponse: false
  }
);
console.log("AFTER running: UPDATE_AI_REPORTS");

The above section runs fine, it logs out everything, including the JSON successfully.

Here’s my 8base config for the 2 funcitons.

HANDLE_FILE_UPLOAD:
  type: trigger.after
  handler:
    code: src/triggers/HANDLE_FILE_UPLOAD/handler.ts
  operation: File.create

UPDATE_AI_REPORTS:
  type: task
  handler:
    code: src/tasks/UPDATE_AI_REPORTS/handler.ts

The beginning of my UPDATE_AI_REPORTS function has a console.log that never logs and there’s no updates in the logs from it since November 2019.

Something seems broken :frowning:

I have also verified the JSON I’m uploading is valid.

I have not made any changes to this function besides adding a console.log from the last time it was working in November. The only difference is that I’ve uploaded files using the GraphQL API instead of using the FileUploader directly in the 8base app.

But after finding this problem. I tried uploading it with the FileUploader in 8base just like before, and it still doesn’t work.

The file size is marginally larger than it was before (1.1 MB vs. 1.0MB) But I’d be very disappointed if you have a 1MB max size for data being sent between functions.

There are no visible errors anywhere. Just nothing happens after it’s supposed to invoke the task.

Hey Mark!

Couple of questions.

  1. Are you trying to run this locally or in production?
  2. Can you try setting waitForResponse to true and letting us know the behavior?
  3. If you check your function logs for UPDATE_AI_REPORT, is there any indication of an invocation at all?

Thanks
Sebastian

1 Like

@sebastian.scholl

Hmmm I’m not sure why but this got me 1 step closer.

  1. In production
  2. Tried setting this to True, and now it invokes just fine. (But why do I have to set this to true?) I don’t need my function to do anything else after it’s invoked the task, I specifically don’t want it to wait for the task to finish.
  3. There was no function logs indicating any invocation at all.

But now even with that set to true, I have new major problem. The task times out at 20 seconds, doing a massive Update (with +2,500 aliases). I can’t find anything anywhere to increase the timeout to longer than 20 seconds :frowning: Creating a separate post for this issue, as it’s unrelated. But this is really frustrating…

Hey Mark - totally understand. I just wanted to pinpoint whether you could get the task function to run at all!

I’ll try to replicate this myself, though suspect it’s the long-running function issue you brought up in the other thread.