Cannot add LineItem to cart with MerchandiseID from ProductVariant

Hi I am trying to add line items to the customer cart from STOREFRONT API as below with the merchandiseId (type ID) of the productVariant received from products query.:

{
    "cartId": "Z2lkOi8vc2hvcGlmeS9DYXJ0L2U2ZmEyZjI0OTZmNGJhNjBmZWZmZWFlZWYxMTQyMzAx",
    "lines": [
        {
            "quantity": 1,
            "merchandiseId": "gid://shopify/ProductVariant/{id received from products query}"
        }
    ]
}

I am getting the below error:

The merchandise with id gid://shopify/ProductVariant/0 does not exist.

However, this does work if I provide the merchandiseId to be a string (same as whats in the url of the admin panel as below underlined in “yellow”)

I am not sure how I can get this “string” type id, instead of the “ID” type id from the products query.

I also encountered the same problem, is it solved now?