Use BackgroundActionTrigger instead of APIActionTrigger
Hi all,
We have some Background actions in our project where we send out Slack messages in case a Background action fails in their final attempt.
We used the
trigger
element of the ActionContext
element to do this.
Basically we did this:
I think since the native support of Typescript in Gadget this seems not to work anymore.
I now have an APIActionTrigger
but I would like to have the BackgroundActionTrigger
instead. Is there a way to configure an action that it receives the BackgroundActionTrigger
as trigger
argument? In the ActionOptions
perhaps? So we can do this check?
Unfortunately I could not find anything in the docs so far.
Thanks in advance!3 Replies
Hello folks,
I wasn't able to reproduce this error in JS so let me see if the trigger type is different in a TS action
I was still not able to reproduce this issue in TS:
Could you please share some more information about what you're seeing? Maybe the app URL and the name of the action so that I can see if there's some reproduction steps that I'm missing
It is the app
agradi.gadget.app
. For instance this action: api/actions/shopifyUpdateProductSetReferences.ts
This action is executed as Background action, but when I try to check in the trigger
object how many attempts were already made. I get a typing error because the trigger
is not of the type BackgroundActionTrigger
. I'm not sure if there is a possibility to identify the action as Background action (in options for instance).
On line 281 I commented out the code that worked before, but since there is now native TS support it gives me errors in the typing
Thanks!
The type cant be background action since a background action is an action put in a queue. I think we just need to expand on the trigger