The most common cause for this issue is a custom next.config.js with the generateBuildId method defined, but it does not return a string.
next.config.js
generateBuildId
Always return a string from generateBuildId.