Showing results for 
Search instead for 
Did you mean: 
Helper IV
Helper IV

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.
Resident Rockstar
Resident Rockstar

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
Community Support

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.

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.

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.

Advocate IV
Advocate IV

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.  

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: 


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. 

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. 

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

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

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

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

@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= HttpCode=OK, 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: 

@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": "",
"clientRequestId": DELETED,
"message": "BadGateway",
"innerError": {
"status": 502,
"message": "Error from Office Service. Url= 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": ""

@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

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.

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.  

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

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


Helpful resources


Celebrating the May Super User of the Month: Laurens Martens

  @LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!        

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started:   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!    

Welcome to the Power Automate Community

You are now a part of a fast-growing vibrant group of peers and industry experts who are here to network, share knowledge, and even have a little fun.   Now that you are a member, you can enjoy the following resources:   Welcome to the Community   News & Announcements: The is your place to get all the latest news around community events and announcements. This is where we share with the community what is going on and how to participate.  Be sure to subscribe to this board and not miss an announcement.   Get Help with Power Automate Forums: If you're looking for support with any part of Power Automate, our forums are the place to go. From General Power Automate forums to Using Connectors, Building Flows and Using Flows.  You will find thousands of technical professionals, and Super Users with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Power Automate community forums. Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered. Galleries: The galleries are full of content and can assist you with information on creating a flow in our Webinars and Video Gallery, and the ability to share the flows you have created in the Power Automate Cookbook.  Stay connected with the Community Connections & How-To Videos from the Microsoft Community Team. Check out the awesome content being shared there today.   Power Automate Community Blog: Over the years, more than 700 Power Automate Community Blog articles have been written and published by our thriving community. Our community members have learned some excellent tips and have keen insights on the future of process automation. In the Power Automate Community Blog, you can read the latest Power Automate-related posts from our community blog authors around the world. Let us know if you'd like to become an author and contribute your own writing — everything Power Automate-related is welcome.   Community Support: Check out and learn more about Using the Community for tips & tricks. Let us know in the Community Feedback  board if you have any questions or comments about your community experience. Again, we are so excited to welcome you to the Microsoft Power Automate community family. Whether you are brand new to the world of process automation or you are a seasoned Power Automate veteran - our goal is to shape the community to be your 'go to' for support, networking, education, inspiration and encouragement as we enjoy this adventure together.     Power Automate Community Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today!  

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Users online (5,251)