NextJS hosted on Vercel 504: GATEWAY_TIMEOUT

I have Nextjs application hosted in vercel. Every other pages work fine except for the one that makes use of getServerSideProps. It always show 504 serverless timeout.

What might be the reason for this? I am stucked for quite a while due to this issue.