We are having the exact same issue with the invitations API. It happens if the API takes 30 seconds to respond. It seems the invitations succeed based on the generated invite email and the new user state in Azure...so far. This is a problem right now because we use the user objectID in the response for subsequent actions.
This is a Microsoft issue to fix. And it looks like it has been for several years.