before i got into the condition i am in, sometimes rides would stress me out and the same thing would happen.
think about it; if you push yourself too far your body goes into high stress mode; symptoms include vomiting and diarrhea. your body eliminates all that will hinder it in the short run (for a quick escape, shall we say)
We learned early on not to push me too hard or this would happen.

As i have gotten stronger, it happens less and less. So you are pushing too hard, ease up. It took me a while before I was comfy doing 40 mile rides
and at much lower speeds than you are riding.
I have also learned to not eat such rich foods; instead when i am doing a long ride;
i eat oatmeal for breakfast; lots of bananas, nothing real rich, lots of simple carbs including cookies and even candy; stuff i don't usually eat.

it's a big mistake to eat like you normally do and then get out and do a hard bike ride.