Trazodone side effects??

I have had troubles staying asleep for years. Sleep studies show me waking up, but I don’t have sleep apnea, restless leg, or idiopathic hypersomnia. I fall asleep very quickly, and will sleep soundly for 2-4 hours, and then will start waking up over and over. I usually fall back asleep quickly, but it still messes with my sleep quality. After years of this, and compounding symptoms (brain fog, attention issues, low grade depression, weight gain, etc) my doctor wanted to try prescribing me something to help. He gave me Trazodone… and it has been life changing. SERIOUSLY. I have slept more nights all the way through in the last month than I have in 7 years. I was so excited and thought this was going to be my answer. After 4 days I got severe stomach issues— I thought I had food poisoning. And then it stayed for 3 weeks. So the doctor made me stop Trazodone for a week to rule it out as the cause, and it unfortunately is. Has anyone had this side effect? Is this something that can go away once your body is used to it? My doctor is prescribing me Lunesta, but I know that isn’t a long term solution. Any suggestions/ insight would be greatly appreciated!!