cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JasonK
Level: Powered On

Bad gateway 502 Onedrive pdf converter

Hello Everyone,

 

I had built a flow 2 months ago that would convert word files on a sharepoint document repository into PDF. Eventually it evolved to converting excel files so a switch case was built to accomodate. This was all working fine for a while until yesterday 10/28.

 

The flow was able to save the file to onedrive but failed on the conversion to PDF with a bad gateway 502 error. In the body it stated:

"The underlying connection was closed: An unexpected error occurred on a send.\r\n inner exception: An error occurred while sending the request.\r\n inner exception: The underlying connection was closed: An unexpected error occurred on a send.\r\n inner exception: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.\r\n inner exception: An existing connection was forcibly closed by the remote host",
 
I attempted to rerun the flow and try other files and resulted in the same thing.
 
I decided to open a support ticket. Support had me rebuild the connector connection and noticed the icon for onedrive had updated. It continued to fail, so we ended up rebuilding a copy of the flow and resulted in the same issue. The tech upon checking the gateways tab was met with a message about needing a subscription stated to me pdf conversion on onedrive needed a premium licensce. I was totally confused stating that it made no sense as the changes occurred oct 1st and still ran fine up until yesterday.  It then evolved into saying i was possibly on a trial account. (I am under GCC g3 Lic, and not using free flow). Eventually he got back to me and explained he was wrong so we further troubleshoot the issue.
 
We ended up opening up IE with browser cache clear. The flow tested and then ran fine without the gateway issue. His explanation was that when i built my flow, the flow designer was possibly pulling in old cached information into building my flow therefore resulting in the gateway 502 errors. Resaving in IE with new cache clear fixed the problem was his explanation. This baffled me as it didnt really make sense that a cloud platform would rely on browser cache to authenticate. This would lead me to believe there are many other users that run into this same scenario using Chrome.
 
Has anyone ran into a similar incident and explanation like this before? Also if anyone knows the onedrive pdf converter requires a premium lic? Or was i fed a bunch of baloney and connections on the backend fixed itself. If this is truly the root cause of the issue, then the flow designer needs to be redesigned.
 
Thanks
Jason
26 REPLIES 26
Super User
Super User

Re: Bad gateway 502 Onedrive pdf converter

not seen that before as you describe but a good one to keep in mind.

 

currently the onedrive pdf conversion is not premium connector i am sure it will change in the future though.

Community Support Team
Community Support Team

Re: Bad gateway 502 Onedrive pdf converter

Hi @JasonK,

 

I have tested on my side using the Chrome, it runs successful, not happened the issue you met:

Annotation 2019-10-29 145846.png

 

Annotation 2019-10-29 145829.png

Convert file into PDF feature not need premium license. The error message is "The underlying connection was closed" , so the issue may be caused by the fact that connection of OneDrive was invalid, to let it go ahead, you need to create a new connection. But sometimes, the invalid connection will store in the browser, so you may need to clear them, and try again. Or save as a copy Flow, export it and import it back, etc. Hope it helps.

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

JasonK
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

Thanks for the reply,

 

Thats the thing, this flow had worked fine for 2 + months and then all of a sudden stopped working. Are there any changelogs on specific functions? Only thing i can think of if something changed with the pdf converter (in terms of code or functionality) that would cause it to stop functioning with old code and require a recreation. Either way this causes a negative impact to users needing to be aware of backend functionality changes.

Community Support Team
Community Support Team

Re: Bad gateway 502 Onedrive pdf converter

Hi @JasonK,

 

At present, it seems that connection is more likely to expire. You can try to recreate a new connection just like I told, if it work, it will be caused by the connection expire.

Or you can recreate the action, if it can resolve your issue, it may be caused by the your deduction.

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

rjhale
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

I'm having a similar issue where the Convert File step results in a Bad Gateway error, but it happens very inconsistently.  For example, I have a Flow the converts a variable set of files to pdf every morning.  This morning it failed converting 3 of 16 files.  Yesterday it failed converting 2 of 8 files.  When I rerun the Flow it either fails on different files or it successfully converts all of them.  There seems to be no rhyme or reason as to when it fails.  

 

I would really like to know of a way make this conversion process more stable short of using a 3rd party connector.  

JasonK
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

From what I can tell this issue is recurring and sporadic because its network issues on microsoft's end. I have a feeling some CDNs where stuff is stored is having connectivity issue thus the bad gateway errors. 

 

My only suggestion is keep opening tickets to MS for this and keep an eye on the admin center health status. There may be some correlations to their network outages and bad gateway msgs that are occurring (Onedrive, Powerautomate, Sharepoint, etc.).

 

One other possible suggestion is take a look at the trigger properties. There is a retry policy setting there: 

 
JasonK
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

My response got flagged as spam for some odd reason.

 

Basically i think the issue is network connection related on microsoft side. 

One thing i would suggest trying is tweaking the retry policy on the trigger policy. 

JasonK
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

And i have cursed myself as BAD GATEWAY on pdf conversion has started popping up again on all pdf conversions since 1/14/20. Opening another ticket with microsoft as no changes were made to the flow. 

rjhale
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

I'm running into the Bad Gateway errors again this morning as well.  I'm in the midwest.  This is getting annoying.  

JasonK
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

Are you in GCC tenant btw? The pattern seems to be network related issue on microsoft's end. Thats my guess

rjhale
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

I am not in a government tenant.  I'm in a regular enterprise tenant.  

JasonK
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

Support was no help. They had me run through the hoops of rebuilding, reconnecting, exporting, importing. Again i told the tech this seems to be at a server or network level on the cloud. They had me do this on IE too. Again what does my browser have to do with a flow working for months then all of a sudden failing when no changes are made on my end?

 

I will update this post accordingly

JasonK
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

@rjhale can you paste your error you are getting? Here is mine. I redacted some ID information but curious to know if the error you are receiving on your 502 is same as mine. Appears some kind of service failure on o365 side

 

"Error from Office Service. Url=https://wordcs.osi.office365.us:973/wordca/wordconversionservice.svc/rest/ConvertFileUrl HttpCode=OK cert=subject:E=wwdcsse@microsoft.com, CN=OneDriveToWord-USGov, OU=Office Service Infrastructure, O=Microsoft Corporation, L=Redmond, S=Washington, C=US;thumbprint:DELETED
ResponseHeaders=ResponseCode: Failure\r\nErrorCode: WordFileDownloadFailed\r\nIsExpectedFailure: True\r\nErrorCategory: BadRequest\r\nServiceID: 
rjhale
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

@JasonK  Here is what I was seeing earlier in the day.  Like the problems I was seeing last week, it errored a couple of times and then ran successfully.  

 

{
"error": {
"code": 502,
"source": "flow-apim-msmanaged-na-northcentralus-01.azure-apim.net",
"clientRequestId": DELETED,
"message": "BadGateway",
"innerError": {
"status": 502,
"message": "Error from Office Service. Url=https://wordcs.officeapps.live.com/document/export/pdf HttpCode=InternalServerError cert=subject:;thumbprint:
ResponseHeaders=X-ErrorCode: WordCantOpenDocument\r\nX-ClientCorrelationId: cf36be38-21f5-4f1c-b90d-3dc3f67c947a\r\nX-ServiceCorrelationId: DELETED-\r\nX-ConversionTimeInMs: 125.0024\r\nX-FileDownloadTimeInMs: 468.7468\r\nCache-Control: private\r\nDate: Thu, 16 Jan 2020 16:30:07 GMT\r\nServer: Microsoft-IIS/10.0\r\nX-AspNet-Version: 4.0.30319\r\nX-Powered-By: ASP.NET\r\n",
"source": "api.connectorp.svc.ms"
}
}
}
JasonK
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

@rjhale Thankyou. Exactly the same arena as the error i have.

 

Can we get someone from microsoft to explain why the service keeps failing intermittently? Phone support keeps troubleshooting the front end (my pc, my browser, my network) when the issue is on the back end with the service that converts the file on the microsoft end. 

 

The overall approach from microsoft on these issues needs to be overhauled for Powerautomate to be successful product. Simply having clients wait for the issue to fix itself is completely ridiculous. (oh the problem fixed itself? lets just close the ticket). There is no root cause or prevention for further occurrences. If there is an outage for a connector then state so, clients will lose patience and not bother with this product. My 2 cents *soapbox

JasonK
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

The issue overnight resolved itself. It appears for this instance the converting service was failing. 

I am not sure if something was done to fix it, or it just "went away". Either way microsoft needs a better way to monitor these outages before pointing to the customer's flow as the issue.

rjhale
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

Same here.  My Flow converted 10 files this morning without issue, and I haven't changed a single thing.  

 

I couldn't agree more about the need for better monitoring.  Having a Flow that fails 10% of the time kind of defeats the purpose of automating the process in the first place.  

JasonK
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

And it just started failing again. I guess I will need to see what Microsoft says.

JasonK
Level: Powered On

Re: Bad gateway 502 Onedrive pdf converter

After retrying the flow 4 times it processed. Has anyone tweaked the retry Policy under the settings of the converter?

 

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (4,456)