Most likely, you are simply dehydrated. Drink more water. Since most people are deficient in magnesium, that might be part of the problem. The body’s true Mg levels will not show up in a blood test, so it’s very safe to supplement with 400mg of magnesium glycinate or magnesium citrate... do not use magnesium oxide. As for potassium deficiency, that might be the culprit, but it’s much easier to drink more water and to supplement with Mg.
Right on, good doctor!