Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Microsoft Flow GatewayTimeout Error Code 502

Hoping that someone in the community will be able to assist, because the guys at support has not been able to. I have a MS Flow that was functioning perfectly for about a month, with no changes to the working Flow, it started failing with BadGateway.


4 Retries Occured4 Retries Occured


The Flow uses a 3rd party action from Plumsail, to Create a SharePoint Site from a Template, custom built for the Organizations needs.  Previously it took between 1 - 2 min to complete. 


Now it takes about 2min, before it starts "retrying the action" and then a couple of seconds later, errors out.  From what I can tell the Flow completes the action but doesn't receive a response during the action that does the Site Creation.  It then resends the request, which in turn gives me an error that the site already exists, because the first action completed.


Retry InformationRetry Information

Response Body:




Flow results show that the site already exist, but if one had to check the flow duration and site creation would be the same.  What I mean with that is that the Flow ran 4 minutes ago and if you look at the sub sites information, it was also created 4 minutes ago.  Meaning that the site was created through the flow, but Flow didn't get a Status Code 200.




The site that we're trying to create contains 3 Document Libraries and 5 Lists.  Inside the libraries, we have various Document Sets created, with some sub folders.  There are 3 custom built Document Sets, that we're going to use with search pages later.  I've rebuilt the Flow and the Template Site that is used during the Flow, more than once, as part of the requests from Support, with no luck. 


To eliminate the possibility of the 3rd party action not working, I've tried using a "Send an HTTP Request to SharePoint" and creating the site using the webinfos API, but I have the same result.  If I use the STS#0, default Team Site Template, it works.  What doesn't add up is why the default team site is working, but not custom site, which has been rebuilt and I use the same site through the GUI and works perfectly.


Now with the request still open with Support still trying to find a solution, I've recreated the entire Solution in my personal O365 Tenant and the Site was created and Flow is surprisingly SUPER FAST, under a minute.  


Does anybody have any ideas?

Community Support
Community Support

Hi @ArmandCronjé,


What’s your current situation? Are you still having the issue?

Error code 502 means that the failure is temporary and transient. Please click Resubmit to the flow again.

In addition, please try to create SharePoint Online site using Azure Functions, the following blog for your reference:


Best regards,


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

Hi Mabel, Thanks for your response. I understand that error code 502 is a temporary and transient, but I've experienced this since middle of August. So resubmitting has the exact same result every time, although my other site collections that has the exact same flow runs without error. I will try the suggested method, using the Azure Function and revert back with my findings. Thanks, Armand Cronjé

Hi Mabel,


I'm not able to complete the Azure Function. The provided Blog imports the Azure Function with the URL, which mine is not successful, I get an error:Importing OpenAPIImporting OpenAPI


I went on to upload this manually, once done, I configure the rest of the Custom Connector and create it.

Upon running the Flow and during testing I get an error 404 "Resource Not Found".  I tried to get more information about this, but solutions that I've found mentions that the body is not present, but mine is.



I then proceeded to create another flow, with a HTTP request, and I called the Azure Function, not using the connector: (The information was hard coded and not using list values)



This attempt suceeded, but unfortunately no site was created.



Do you perhaps have another idea or is there something I'm doing wrong.





I'm having this same issue and it's incredibly frustrating. This wasn't always the case.


I am also on SharePoint Online (maybe this started in August?) and I was using SP 2013 Workflows to create the subsites. What began happening was the Workflows would continue without receiving a responseCode which threw the entire WF logic out of sync. I moved it to Flow and receive exactly what you're experiencing here.


My templates aren't very large at all, and the closest I've been able to get to understanding it is that it might have to do with the number of Workflows that I'm provisioning within the template itself? I can't say for sure, but this problem began spontaneously and is really causing me a hard time coming up with a solution.

Helpful resources

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group


Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (81,607)