Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Unanswered

Bad Gateway 504 Error

(0) ShareShare
ReportReport
Posted on by 1,663 Super User 2025 Season 1

I have a flow that is trying to execute a stored procedure in an Azure SQL database, the SP runs fine (3-5 minutes) in SSMS, but in flow it fails every time with a bad gateway/timeout error.

 

i've tried the execute stored procedure step as well as the execute SQL query both fail. I have other steps that read from the same connection to the same server/database. I put a parameter on the sp to see what happens and when i put the parameter to just return a select statement, it ran without issue. But when the flow tries to run the full SP which truncates a table and inserts new records, it fails

Annotation 2020-07-16 112809.png

{
"error": {
"code": 504,
"source": "flow-apim-msmanaged-na-westus2-01.azure-apim.net",
"clientRequestId": "921d218a-8b4d-4402-a508-72f3059d6c4e",
"message": "BadGateway",
"innerError": {
"status": 504,
"message": "Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.\r\nclientRequestId: 921d218a-8b4d-4402-a508-72f3059d6c4e",
"error": {
"message": "Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
},
"source": "sql-wus.azconn-wus.p.azurewebsites.net"
}
}
}

  • srduval Profile Picture
    1,663 Super User 2025 Season 1 on at
    Re: Bad Gateway 504 Error

    @Toltekrom The two objects do the same thing in this case depending on how you construct the SQL statement. So it is not the "Wrong" object besides I tried it with both objects and still had the gateway error. The issue is a hardset timeout of 120 seconds that can not be manually overridden. So if automate doesn't get a "progress" report within that 2 minutes, it terminates the workflow. So in this case SQL doesn't communicate anything to Automate while the SP is executing, so it hits the 120 seconds of no communication and terminates the flow.

  • Toltekrom Profile Picture
    on at
    Re: Bad Gateway 504 Error

    Hope you found the issue. What I see you are using the wrong Power Automate object - Execute a SQL Query instead of Execute a Store Procedure 

  • srduval Profile Picture
    1,663 Super User 2025 Season 1 on at
    Re: Bad Gateway 504 Error

    @Msft @EUG-MSFT  I'm having problems loading the MS support site, it is just spinning on my end and not loading. Is there an alternative way to create a support ticket?

  • srduval Profile Picture
    1,663 Super User 2025 Season 1 on at
    Re: Bad Gateway 504 Error

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow