Sporadic 502s during build

Are execution times usually longer during the build process?

Not necessarly. Can you trace this to a specific page(s) at build time? What are you doing on that getStaticProps call?

Perhaps you can add a few console.logs to trace the time it takes on each step as described on our article:

Hope this helps!