Subordinate interrogative clauses (embedded questions) don't normally have subject/aux inversion so your first example is fine. Apparently, some varieties of English (mostly AmE) allow such interrogatives with inversion in contexts of strong question-orientation. They would allow your second example.
– BillJFeb 27 '23 at 13:05