forShopId in background action is undefined
I am sure we have plenty of tasks that call
connections.shopify.forShopId
in a background action context to write to our own store, but suddenly it has stopped working in one instance.
When I try to run a task that writes to our Shopify store in a background action, the forShopId
method of connections.shopify
is undefined. connections.shopify
is there, it has some properties on it, but not forShopId
.
Weirdly there is no error generated or logged, the background action says it completed just fine but the action seems to stall / fail quietly.
App: authentified--development.gadget.app
JobId: job-h_eileRk5g66wtwbvIKes
TraceId: ad2a347eac8ea4d7484d62cac8526997
is a trace in a background action, 9bdb84466d083f564c4ae575461662ce
is a trace when I run the same code in a normal action2 Replies
Hello,
What's the action that you're running? I'd like to take a look at it. Connections should never be undefined (unles you don't have the connection). connections.shopify.current can be undefined in cases where the Gadget platform can't set the current shop context, thats the case in a background action, but connections.shopify.forShopId("someId") should give you a shopify connection if the id is valid
Weirdly I deleted and re-created the action, now it works. The only difference was I created the first action in my IDE, the second I created in the Gadget UI