Volume Discount Function API is not working

Hello,> > We are encountering an issue with the Volume Discount Function API. Whenever we send a request through Postman, we receive an “internal server error” message. We have included the GraphQL queries and their outputs below. Please Provide us a Solution.

Test Cases
Case i)
Query : 
{
	shop {
		name
	}
}
Output :
Status 200 with proper output

Case ii) 
mutation {
  discountAutomaticAppCreate(automaticAppDiscount: {
    title: "Custom price",
    functionId: "",
    startsAt: "2024-06-22T00:00:00",
    combinesWith: {
      orderDiscounts: true,
      productDiscounts: true,
      shippingDiscounts: true
    },
  }) {     
     userErrors {
      field
      message
     }
     automaticAppDiscount {
      discountClass
      title 
      startsAt
      discountId
    }
  }
}
Output :
{
    "errors": [
        {
            "message": "Internal error. Looks like something went wrong on our end.\nRequest ID: 0eec6bac-e14d-4571-a658-7d6893ca9910-1719579159 (include this in support requests).",
            "extensions": {
                "code": "INTERNAL_SERVER_ERROR",
                "requestId": "0eec6bac-e14d-4571-a658-7d6893ca9910-1719579159"
            }
        }
    ]
}

Case iii) 
mutation {
  discountAutomaticAppCreate(automaticAppDiscount: {
    title: "custom price",
    functionId: " ",
    startsAt: "2024-06-22T00:00:00",
    combinesWith: {
      orderDiscounts: true,
      productDiscounts: true,
      shippingDiscounts: true
    },
  }) {     
     userErrors {
      field
      message
     }
     automaticAppDiscount {
      discountClass
      title 
      startsAt
    }
  }
}
Output: Status 200 but when we check on backend, discount is not created
{
    "data": {
        "discountAutomaticAppCreate": {
            "userErrors": [],
            "automaticAppDiscount": {
                "discountClass": "PRODUCT",
                "title": "custom price",
                "startsAt": "2024-06-22T00:00:00Z"
            }
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 10,
            "actualQueryCost": 10,
            "throttleStatus": {
                "maximumAvailable": 2000.0,
                "currentlyAvailable": 1990,
                "restoreRate": 100.0
            }
        }
    }
}

Hello,

You can try this solution to create a discount through the GraphQL API.
It worked perfectly for me.

Query: mutation CreateAutomaticDiscount($discount: DiscountAutomaticAppInput!) {
  discountCreate: discountAutomaticAppCreate(automaticAppDiscount: $discount) {
    automaticAppDiscount{
      title
    }
    userErrors {
      code
      message
      field
    }
  }
}

Variables: {
  "title": "First discount"
  "functionId": "YOUR_FUNCTION_ID",
  "combinesWith": {
    "orderDiscounts": true,
    "productDiscounts": true,
    "shippingDiscounts": true
  },
  "startsAt" => "2024-09-24T18:10:45.362Z"
}

Hope this helps,
CodeRagon Infotech

Shopify Apps Development Agency