web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Bad gateway 502 error ...
Power Automate
Answered

Bad gateway 502 error when calling Excel Office Script from Power Automate flow

(2) ShareShare
ReportReport
Posted on by 21

Hi,

 

I have a flow which has been running every day for many months up until this morning.
The flow triggers when a file is uploaded to sharepoint, depending on the filename it then runs one of two office scripts in excel.

The flow is failing when it tries to call either of the office scripts with Bad Gateway 502

 

{
  "error": {
    "code": 502,
    "source": "flow-apim-europe-001-northeurope-01.azure-apim.net",
    "clientRequestId": "3194d889-f6f9-4bbc-aab7-14837957bc42",
    "message": "BadGateway",
    "innerError": {
      "message": "The server experienced an issue and couldn't run the script. Please try again in a few moments.\r\nclientRequestId: 3194d889-f6f9-4bbc-aab7-14837957bc42",
      "logs": null
    }
  }
}

Does anyone have any idea what could cause this to suddenly start happening when it was fine yesterday?

Thanks,
Categories:
  • Dschorb Profile Picture
    on at

    Same problems here. I have several flows that worked without any problems. With the excel script it gets stuck, runs through a few retries and then gives me this error:

    {
      "error": {
        "code": 502,
        "source": "flow-apim-europe-002-westeurope-01.azure-apim.net",
        "clientRequestId": "ae2a1686-9f6f-4d13-a389-1c27d2aae18d",
        "message": "BadGateway",
        "innerError": {
          "message": "The server experienced an issue and couldn't run the script. Please try again in a few moments.\r\nclientRequestId: ae2a1686-9f6f-4d13-a389-1c27d2aae18d",
          "logs": null
        }
      }
    }
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I'm getting the same error - was working fine last night, but started failing on the run this morning.


    Using the Excel connector (business) 'Run script from Sharepoint library'. 

    In UK.

     

    Cheers

  • MancMonkeyUK Profile Picture
    21 on at

    looks like a wider issue then

    whats strange is that someone else in my team - their office script flows have run fine today

  • Verified answer
    MancMonkeyUK Profile Picture
    21 on at

    I've managed to fix the issue. I had to create a new connection to Excel.

    1 - Edit the flow
    2 - Go to the step that calls the script
    3 - Where it shows the connection, click on Change connection
    4 - Add new and make a new connection to Excel
    5 - Change all actions that call Excel office scripts to use the new connection.

    @Dschorb  @Anonymous  This worked for me. Hopefully, it does for you too.

    No idea why the old connection stopped working though.

  • Dschorb Profile Picture
    on at

    Thanks for this hint! It worked for me as well.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @MancMonkeyUK Thanks MancMonkey!

     

    This worked after I created a new connection and attached all the excel actions in the flow to the new connection.

    Cheers,

     

  • nich3play3r Profile Picture
    253 on at
    I'm having this exact issue today with a Run Script from SharePoint Library action that worked fine up until this morning. 502 bad gateway.
     
    Steps I've taken to resolve, with no luck:
    • Created a new connection
    • Re-created the action in the flow (using the new connection)
    I double checked that the user specified in the connection has access to the SharePoint library where the script is stored AND has edit access to the actual script itself.
     
    I realize there's not much new information out there on the cause of this issue, but if anyone else has experienced this and resolved it via any other means than those mentioned above, I'd sure love to hear about it.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 414

#2
11manish Profile Picture

11manish 335 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard