question

GKelly-0663 avatar image
2 Votes"
GKelly-0663 asked saldana-msft edited

Receiving 404 "Invalid version: graph.microsoft.com" for 80% of requests

Hi,

Our code for querying https://graph.microsoft.com/v1.0/me stopped working suddenly today. We request the users details with the OAuth access token.

The request fails roughly 80-90% of the time, with the following response:

{"error"=>{"code"=>"ResourceNotFound", "message"=>"Invalid version: graph.microsoft.com", "innerError"=>{"date"=>"2021-04-06T11:46:43", "request-id"=>"29fca351-e7ff-40f7-b353-fdb432d5c4fa", "client-request-id"=>"29fca351-e7ff-40f7-b353-fdb432d5c4fa"}}

We are sending a simple HTTPS request using the standard Ruby libraries and have no idea why this has suddenly stopped working.

Any insight is greatly appreciated.

microsoft-graph-usersmicrosoft-graph-identity
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RoelandMatthijssens-0179 avatar image
0 Votes"
RoelandMatthijssens-0179 answered GKelly-0663 commented

I've been spending all day figuring this out as well. I switched to Faraday (from vanilla Net::HTTP) and i get the proper responses now. Not sure if this is an option for you. But it got me going again.

The reason why it's going wrong is because (at least for me) the Net::HTTP client was constructing a faulty URI to send the request to. I saw this by installing the httplog gem to verify the requests. and i saw something along these lines: (Notice the double https://graph.... in the POST request)

 D, [2021-04-07T17:42:09.050306 #2373045] DEBUG -- : [httplog] Connecting: graph.microsoft.com:443
 D, [2021-04-07T17:42:09.225682 #2373045] DEBUG -- : [httplog] Sending: POST http://graph.microsoft.com:443https://graph.microsoft.com/v1.0/users/<....>/onlineMeetings
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

You may have ran into the same issue as us.

Is it possible you were doing the following?

url = "https://graph.microsoft.com/v1.0/me"
get_request = Net::HTTP::Get.new(url)


If so then you probably need to do this:

uri = URI("https://graph.microsoft.com/v1.0/me")
get_request = Net::HTTP::Get.new(uri)


Fixed the problem for us!

0 Votes 0 ·
Deva-MSFT avatar image
0 Votes"
Deva-MSFT answered

Also just to isolate the issue outside of your code/library, i would try with Microsoft Graph Explorer or POSTMAN to see if you can repro the issue with same Graph API call or not.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

50960780 avatar image
0 Votes"
50960780 answered

I saw the same issue when trying to access https://graph.microsoft.com/v1.0/me/messages through a proxy. The framework that I was using was rewriting the request to use the full URI, so it ended up sending

GET https://graph.microsoft.com/v1.0/me/messages HTTP/1.1

rather than

GET /v1.0/me/messages HTTP/1.1

This behaviour seems common (actually required by some RFC) for plain HTTP proxies but for HTTPS this transformation seems unnecessary. Could it be that some Microsoft servers started to be more finicky about this a few weeks ago?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.