Opioids during pregnancy

So when I was 25 weeks they found 3 kidney stones in my kidneys and I had to have surgery. I just had another surgery to replace the stent they put in I have been on and off opioids since I was 25 weeks I am now 30 weeks I’m really scared for my baby but I can’t bear the pain. What can I do? I’m so worried