Timeout error converting DOCX to PDF

Sebastian M 20 Reputation points
2024-04-05T09:16:51.5066667+00:00

I am attempting to convert a DOCX file to PDF using the Microsoft Graph API with the following request:

https://graph.microsoft.com/v1.0/sites/XXX/drive/items/XXX/content?format=pdf

However, I receive a timeout error after 47 seconds with the following response:

{
	"error": {
		"code": "generalException",
		"message": "The operation has timed out.",
		"innererror": {
			"code": "General_Timeout"
		}
	}
}

Response headers:

cache-control: private
content-length: 146
content-type: application/json; charset=utf-8
x-aspnetmvc-version: 5.2
access-control-expose-headers: x-cache, x-msedge-ref, x-azure-ref-originshield
server-timing: Provider;dur=0,StreamRead;dur=0,TotalRequest;dur=45023,Sandbox;dur=0
request-stat: Cached;False,RemoteReads;1
x-correlationid: 21e5a04a-fb2f-421d-a5a4-407b2335b6b2.9413656f-82f5-4946-865f-bb8197bb090f
x-onedrivemeta-version: 0.0.0.0
x-onedrivemeta-build: Media_prod_31502097_033124.1_03-14-2024
x-onedrivemeta-region: northeurope
x-errorcode: General_Timeout
x-errortype: Unexpected
x-errorsource: Service
x-aspnet-version: 4.0.30319
x-cache: CONFIG_NOCACHE
x-msedge-ref: Ref A: D81EF79A78BB4982B8577F51F461CDB3 Ref B: MAD30EDGE0706 Ref C: 2024-04-05T09:09:29Z
date: Fri, 05 Apr 2024 09:10:13 GMT

I have checked the client timeout, which is set to 0, and I am only trying to convert one file. Interestingly, the conversion works when performed using Microsoft Word online. Can anyone help me solve this issue?

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Deepanshu Sharma 500 Reputation points Microsoft External Staff
    2024-04-07T20:21:55.8433333+00:00

    Hello Sebastian M

    When dealing with large amounts of data that cause timeout exceptions, consider using paging. Paging allows you to retrieve data in smaller chunks, which can help avoid timeouts and improve performance. You can find more information about paging in the Microsoft Graph API documentation.

    Additionally, you can increase the timeout duration by setting it explicitly in your code.

    Lastly, ensure that the document file is not locked or being used by other users, as this could be related to a deadlock scenario.

    Above approaches can potentially solve your problem.


  2. Amandeep Singh 0 Reputation points
    2025-09-18T06:20:47.5966667+00:00

    Hi , i am also facing the same issue , not able to upload even 2.77 mb file , this is acutally something which is to be taken care of , kindly guide us for this .

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.