Unable to test Fulfillment Constraint

I am running into an issue when trying to test the Fulfillment Constraints function.

I keep getting this error from the Shopify GraphQL Admin app, however I have the scope deployed, linked to the .toml, and I have accepted the prompt to update the access scopes within my development store.

Here is my mutation:

mutation fulfillmentConstraintRuleCreate($deliveryMethodTypes: [DeliveryMethodType!]!, $functionId: String!, $metafields: [MetafieldInput!]) {
  fulfillmentConstraintRuleCreate(deliveryMethodTypes: $deliveryMethodTypes, functionId: $functionId, metafields: $metafields) {
    fulfillmentConstraintRule {
      function {
        id
      }
    }
    userErrors {
      field
      message
    }
  }
}

Variables

{
  "deliveryMethodTypes": ["SHIPPING"], 
  "functionId": "my-id-goes-here",
  "metafields": [
    {
      "namespace": "custom",
      "key": "pickup_from_store",
      "type": "boolean",
      "value": "false"
    }
  ]
}

Do I need to request access to this scope?

Please run the query to verify the currently granted access scopes

query {
  currentAppInstallation {
    accessScopes {
      description
      handle
    }
  }
}

Do you run the deploy command after making the app configuration changes?

Thank you. I do not see the scope within the store. I will try to reinstall the app again. This didn’t work before.

I tried to uninstall, and re-install and it did not work. I even built and deployed a Delivery Customization function to see if it was something I am doing wrong, but I think there could be something wrong on the Shopify side. It is possible I did miss something.

Do you see the scope in the partner dashboard app settings?

Yes.

Have you opened the app up in the shopify admin? Sometimes you have to do that and then it propmts you to accept new permissions.

Yes

1 Like

Are you using graphQL admin app to run the mutation query? Some scopes aren’t available within the GraphiQL app.

Use a local GraphiQL instance. If you are developing an app using Shopify CLI, you can launch GraphiQL while running the dev command by tapping the g key. Shopify CLI’s GraphiQL instance connects as your app, so it has the same access scopes as your app, and it can access data owned by your app. It can’t access data owned by other apps.

2 Likes

Oh yeah you shouldn’t be running this from the graphiql admin app - it doesn’t have the same permissions your app has - when you do shopify app dev in the cli it gives you a url to open up an app-scoped graphql interface where you can test queries.

1 Like

@AMaL @kalen - That was it. Wow, I had no idea you could not use the GraphQL Admin App for this. That has been my default. THANK YOU!!!

1 Like