discountNode always giving null

query RunInput {
  cart {
    lines {
      id
      quantity
      merchandise {
        __typename
        ... on ProductVariant {
          id
        }
      }
    }
  }
  discountNode {
    metafield(
      namespace: "$app:product-discount"
      key: "function-configuration"
    ) {
      value
    }
  }
}

I have created an extensions named product-discount to give automatic discounts based on products on cart. The extension gave me run.js and run.graphql files.

I have created an discount using GraphiQL App. Also I am getting that value using that app.

{
     "id": "gid://xxx",
     "metafields": {
     "edges": [
       {
        "node": {
        "id": "gid://xxx",
        "value": "{\"value\":\"42\"}",
         "namespace": "app--xx--product-discount"
     }
    }
   ]
  },
  "discount": {
    "startsAt": "2022-06-22T00:00:00Z",
    "endsAt": null
  }
}

But while I am running the code and debug, the discountNode always giving null.
What could be the problem?

The $app will use the private app namespace of the app making the call. If you are using the graphiQL app installed on the Shopify store it will be creating those metafields with that app’s namespace.

If you use the GraphiQL app that is bundled with the Shopify CLI instead it will use the same $app private namespace as your app and should work.