Several times in the New Testament, we are told not to make oaths but to make simple statements of affirmation or denial. For example...
33 “Again, you have heard that it was said to the people long ago, ‘Do not break your oath, but fulfill to the Lord the vows you have made.’ 34 But I tell you, do not swear an oath at all: either by heaven, for it is God’s throne; 35 or by the earth, for it is his footstool; or by Jerusalem, for it is the city of the Great King. 36 And do not swear by your head, for you cannot make even one hair white or black. 37 All you need to say is simply ‘Yes’ or ‘No’; anything beyond this comes from the evil one.
12 Above all, my brothers and sisters, do not swear—not by heaven or by earth or by anything else. All you need to say is a simple “Yes” or “No.” Otherwise you will be condemned.
However, near the beginning of Paul's letter to the Galatians, he seems to make an oath himself.
20 I declare before God that what I am writing to you is not a lie.
Sadly, no reference to a cake, but anyway, it seems like Paul is making an oath based on God Himself. How can these passages be reconciled?