String.replace Error: Maximum call stack size exceeded [closed]

error image
I am new to nextjs and working on stack overflow clone by following a tutorial, my webpage was running fine but as soon as i started implementing server side things , it started to show this error.
enter image description here enter image description here

  • I tried to search it everywhere on Chatgpt, tutorial, github copilot but didn’t got the result, first it also showed error image, but somehow got it fixed , but the above error is not fixable by any means. I am a newbie to this, i am really looking forward for your help, if required i can share more codes and files which may be breaking my webpage.
    thank you