Parshat חיי שרה is one of three places in תנ״ך that has a biblical character making a condition with Hashem. In two of the three cases, the results were positive. In the third case, disastrous.
The first example was Eliezer who made a stipulation that the maiden who would draw water for him and his camels, would be the one fitting to marry Yitzchak. Good results as Rivka was a fitting wife.
The second situation was when Shaul Hamelech declared that the one who successfully slayed Goliath, would get to marry his daughter. He was granted to have David as his son in-law.
In the final, unfortunate case, Yiftach announced that the first thing that came out of the tent, would be sanctified to G-d. Sadly, it was his daughter who was doomed for life and never married.
The Rabbis do not recommend making such conditions. Only Yakov’s cry to Hashem was considered appropriate when he asked for food and clothing if Hashem would remain with him. Shabbat Shalom