We were with the Prophet ﷺ on a journey during a dark night, and we could not tell where the qiblah was, so each of us prayed in whatever direction he was facing. When morning came, we mentioned this to the Prophet ﷺ, and then the verse was revealed, "So wherever you turn, there is the face of Allah" [Baqarah 2:115].
حدثنا محمود بن غيلان حدثنا وكيع حدثنا أشعث السمان عن عاصم بن عبيد الله
كنا مع النبي ﷺ في سفر في ليلة مظلمة فلم ندر أين القبلة فصلى كل رجل منا على حياله فلما أصبحنا ذكرنا ذلك للنبي ﷺ فنزلت {فأينما تولوا فثم وجه الله}
[Its chain of transmission is daif]. Ibn Majah also narrated it in "Establishing the Prayers, chapter on one who prays facing other than the qibla without knowing," no. 1020, from the hadith of Ashath Samman, with the same wording. Amr bin Qays followed him in narrating it, as found in Tayalisi, no. 1145.Asim bin Ubaydullah is daif. There is a daif corroborating narration for it in Bayhaqi and others.