Where can I find the correct functionId for Delivery Customization?

Hi,

I created a new delivery customization function using:

npm run generate extension

Everything was generated correctly. In the shopify.extension.toml file I see:

uid = "7caef09d-bc92-c4fe-9c8c-5e43dc1b38bce5a7fa55"

I assumed this is the functionId.

I have the write_delivery_customizations permission and I’m trying to run:

mutation deliveryCustomizationCreate($input: DeliveryCustomizationInput!) {
  deliveryCustomizationCreate(deliveryCustomization: $input) {
    deliveryCustomization {
      id
    }
    userErrors {
      code
      field
      message
    }
  }
}

with variables:

{
  "input": {
    "functionId": "7caef09d-bc92-c4fe-9c8c-5e43dc1b38bce5a7fa55",
    "title": "test",
    "enabled": true
  }
}

But I get the following response:

{
  "data": {
    "deliveryCustomizationCreate": {
      "deliveryCustomization": null,
      "userErrors": [
        {
          "code": "FUNCTION_NOT_FOUND",
          "field": [
            "deliveryCustomization",
            "functionId"
          ],
          "message": "Function 7caef09d-bc92-c4fe-9c8c-5e43dc1b38bce5a7fa55 not found. Ensure that it is released in the current app (258144567297), and that the app is installed."
        }
      ]
    }
  }
}

My question is:

:backhand_index_pointing_right: Where can I find the correct functionId?

The app I’m working on is using the dev dashboard. I can’t see extensions tab:

Thanks in advance for your help!

Use the below query to get the function id

query {
  shopifyFunctions(first: 25) {
    nodes {
      app {
        title
      }
      apiType
      title
      id
    }
  }

}

@AMaL thank you,

Is there a simpler way?

In the Shopify Partners dashboard there used to be an Extensions tab with a list of all functions:

When clicking on a specific function, you could see its ID and version:

Is there an equivalent view in the new dev dashboard, or is the GraphQL query the only way to fetch the function ID now?

Go to the new dev dashboard → select your app → Logs → Select the Function tab → Click any of the log → You can see the ID(Function Id)

Yes, it’s true that you can see the function details in the logs, but in order for a log to appear, the function first has to be executed in the store.

For it to execute, it needs to be added.

And to add it – you need the function ID.

I think this way of obtaining the functionId is not very efficient. It should be exposed directly in the dashboard, just like it used to be in the Extensions tab.

This is visible from the versions tab, if you click the currently active version (such that it expands):

@bkspace yes, I used it and I have error:

{
  "data": {
    "deliveryCustomizationCreate": {
      "deliveryCustomization": null,
      "userErrors": [
        {
          "code": "FUNCTION_NOT_FOUND",
          "field": [
            "deliveryCustomization",
            "functionId"
          ],
          "message": "Function 7caef09d-bc92-c4fe-9c8c-5e43dc1b38bce5a7fa55 not found. Ensure that it is released in the current app (258144567297), and that the app is installed."
        }
      ]
    }
  }
}

I’m being silly :man_facepalming: - the UID is NOT the functionId. I think you’re right that this bit of data is missing from the dev platform/would be nice to have. @NickWesselman - perhaps some good feedback here?

1 Like

for GraphQL query I have different id:

{
  "data": {
    "shopifyFunctions": {
      "nodes": [
        {
          "title": "Delivery Customization",
          "id": "01993884-b9bc-7b69-b3a6-56f0ef7bc847"
        }
      ]
    }
  }
}

01993884-b9bc-7b69-b3a6-56f0ef7bc847 is a valid function id in my case.

Hey y’all,

I wrote about this here.

The shopifyFunctions query is the best way to get the ID needed for activation right now. We have a forthcoming update that will switch function activation to use the handle by default, so you will no longer need to worry about environment-specific IDs for function activation.

-Nick

1 Like