Unable to add additional Shopify model field to schema

I have added the destination and deliveryMethod fields to the ShopifyFulfillmentOrder model schema.ts in the shopify fields array however these fields are not being created or reflected in the Gadget UI Is there a way I can force Gadget to reevalutate the schema.ts file and rebuild the model? Additionally if I add a junk field that is not supported I get Invalid Shopify field found in "schema.shopify.fields" Your app will not be operational until all fatal errors are fixed. which suggests that Gadget is happy with the new fields (destination and deliveryMethod) since no error is thrown - but is not adding them Any help would be much appreciated
export const schema: GadgetModel = {
type: "gadget/model-schema/v1",
storageKey: "DataModel-Shopify-FulfillmentOrder",
fields: {},
shopify: {
fields: [
"assignedLocation",
"deliveryMethod", // <-- TRYING TO ADD
"destination", // <-- TRYING TO ADD
"fulfillAt",
"fulfillBy",
"fulfillmentOrderLineItems",
"internationalDuties",
"location",
"order",
"orderName",
"orderProcessedAt",
"requestStatus",
"shop",
"shopifyCreatedAt",
"shopifyUpdatedAt",
"status",
"supportedActions",
],
},
};
export const schema: GadgetModel = {
type: "gadget/model-schema/v1",
storageKey: "DataModel-Shopify-FulfillmentOrder",
fields: {},
shopify: {
fields: [
"assignedLocation",
"deliveryMethod", // <-- TRYING TO ADD
"destination", // <-- TRYING TO ADD
"fulfillAt",
"fulfillBy",
"fulfillmentOrderLineItems",
"internationalDuties",
"location",
"order",
"orderName",
"orderProcessedAt",
"requestStatus",
"shop",
"shopifyCreatedAt",
"shopifyUpdatedAt",
"status",
"supportedActions",
],
},
};
5 Replies
muchi
muchi•3w ago
Hey Kara, at first look I can see that the deliveryMethod field is a hasOne to the ShopifyDeliveryMethod model. The destination field is also a hasOne to the ShopifyFulfillmentOrderDestination model. Do you have these models enabled in your shopify connection (and do you have the schema.ts files for them?)
Kara
KaraOP•3w ago
Thank you Jenny! Adding those models in worked. In a previous Shopify version those fields were json type so it didn't occur to me that they might need additional models. Okay new discovery which I don't think is expected behaviour @muchi 🥹 It seems ShopifyFulfillmentOrderDestination records are not being created when the fulfillment_orders/order_routing_complete webhook is received I would expect these to be created at the same time as the ShopifyFulfillmentOrder records I can confirm that the expected relationships exists ShopifyFulfillmentOrderDestination.fulfillmentOrder belongsTo ShopifyFulfillmentOrder and ShopifyFulfillmentOrder.destination hasOne ShopifyFulfillmentOrderDestination Let me know if I should create a new bug ticket for this!
muchi
muchi•3w ago
Hey Kara, do you have a trace id of an example fulfillment_orders/order_routing_complete webhook not creating the related ShopifyFulfillmentOrderDestination record? We do have some logic to fetch for this related data for this webhook topic so I just want to take a closer look!
Kara
KaraOP•3w ago
Here is a trace id example ec3b422f30899b8062033f7d69110c77 - thanks for taking a look!
muchi
muchi•2w ago
Sorry for the delayed response! We've found the cause of the issue and are working on a fix. We'll update you once that fix is live!

Did you find this page helpful?