msgraph-sdk-go: New Users throwing inconsistent error
Hello,
I’m using this SDK to create new Azure AD users
newUser, err := c.Users().Post(requestBody)
is a snippet of the code I’m using
While testing the code in my lab there are times when the Post will randomly fail I’ve extracted the error Code and Message when it fails
Code=BadRequest
message=Unable to read JSON request payload. Please ensure Content-Type header is set and payload is of valid JSON format.
There aren’t any failures logged in Azure (which makes sense based on the error)
I’m wondering why (if anything) can be done to prevent this error As I said the error is very intermittent. If I run the code again right away it might succeed.
For example, I added a test to range over 5 users and create them. If I run it 10-15 times I would say every time I run it I’ll get at least 1-2 failures. There is no rhyme or reason which users will fail. I suppose I could write my own retry where if that error presents itself it just tries again, but figured I would reach out in case I’m missing something
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (7 by maintainers)
Oh 🤦♂️ I wasn’t looking at the original replace close enough
Alright, this makes sense to me now. Hopefully next time I run across something I’ll be able to just PR a fix myself.
Hey @baywet ,
Yeah more than happy to. I’m a bit new to Go so might take a few to figure out, but I’ll give it a go (pun intended)