I can see how that can feel like an impossible situation in early sobriety. Trust me, I've been there before too many-a-time.
It's common for us addicts to white-knuckle our sobriety and then crumble when the craving and opportunity overwhelms us. I did that for years until I was taught that I have to do MORE than just not drink. I had to have plans in place for when I felt triggered.
Think about what you'll do next time. Heck - consider all your trigger places/things/people and think about what you're going to do when you're faced with them. Can you call a safe friend or family member? Can you go somewhere? Can you keep busy with a sober activity? These are just suggestions.
Best wishes, and don't beat yourself up too much.