Replies: 3 comments 1 reply
-
The hardest thing about this change might be the type inference. We want the return type to come from the extra callback, not the normal place. As the regular function is going to throw behind-the-scenes, we could return an empty object cast as the actual return. That would give us the correct type. |
Beta Was this translation helpful? Give feedback.
-
Do we also want to be able to pass in a handler to verify Re auth, we could append a random secret to callbackUrl. No need for client-side handlers. Example:
Changed your mind on this yet? Can see some potential issues, as the next task will presumably depend on this output for some further action. Anything wrong with just failing the task with a timeout error? |
Beta Was this translation helpful? Give feedback.
-
This has been released now in |
Beta Was this translation helpful? Give feedback.
-
The Replicate API supports creating predictions with a webhook url (see here) and we need to add support for "remote callback" style tasks to achieve the following APIs:
The
createAndWaitForCompletion
method could be implemented like so:That
callback
option to runTask will need to be added, and it will have the following effects:this. _apiClient.runTask
will beWAITING
intrigger.dev/packages/trigger-sdk/src/io.ts
Line 558 in eb4ca0c
To support this the following will need to be changed (possibly not an exhaustive list)
RunTaskService
(trigger.dev/apps/webapp/app/routes/api.v1.runs.$runId.tasks.ts
Line 84 in eb4ca0c
callback
optionFor an example of how to resume the run see how we do it in PerformTaskOperation:
trigger.dev/apps/webapp/app/services/tasks/performTaskOperation.server.ts
Line 223 in eb4ca0c
Beta Was this translation helpful? Give feedback.
All reactions