I suffered with this most of my life. Anxiety was the cause for me. My anxiety was diagnosed only recently for unrelated reasons but the treatment has had the fortunate side effect of fixing my shy bladder!
You can't pee if you aren't relaxed. You can't relax with debilitating anxiety.