Top
PowerApps

PowerApps export as package fails due to missing connections


Sometimes when we are working with PowerApps, adding new connections like to Microsoft Flow or external services and then we decide we don’t need some of them anymore and therefore we are removing it, but forgetting to first delete it in PowerApps, we are finding ourselves in situation, where when trying to export the app as a package, we are facing a very hard to debug issue.

When such situation can occur?

Imagine, you have a button that when clicked triggers Flow. Or is sending e-mail through Office365 Outlook connector. While working with the app you realizes, that the Flow is wrong, or the connector uses wrong credentials. So you are deleting the Flow or connector.

Next you realize, that the button in your PowerApp causes an error, because it is bond to a non-existing Flow/ Connector. So you simply remove that code from button’s “onclick” or replace it with something else, or… remove a button from the app instead of FIRST removing that related Flow/ Connection from the app, by clicking the Button, then “Action->Flows” and then from the associated list – “Remove from app”, like below:

Removing Flow connection from the PowerApps button
Removing Flow connection from the PowerApps button

Then you publish the app and… forget about that situation. Versions later you want to export it, but instead you only see a red bar (red!!!) showing: “Could not find flow ‘GUID’.” or “Could not find connection ‘GUID’.”:

Error exporting PowerApps as a package
Error exporting PowerApps as a package

Why export fails?

The reason why the issue appears is that export mechanism is trying to get all the Connections it has defined in app so therefore when importing the app later user is going to be able to define them and provide credentials. Since that particular connection doesn’t exist (as it was deleted), but there is still a reference to it from the application, export mechanism cannot find it, access it details and therefore to complete it’s execution.

How to debug?

There wouldn’t be nothing bad about the issue, if not the fact, that as a reason we are only given a GUID of the missing connection, not it’s name or any other information that could help us to debug.

Nevertheless even if we knew what was missing, I don’t know any way to restore that missing connection preserving it’s GUID.

Meanwhile, to find out what is missing, the simplest way is to do the following (I am using Visual Studio Code for that purpose):

  1. Save your app locally, on your computer,
  2. Change file extension from *.msapp to *.zip,
  3. DO NOT UNZIP! Just open using 7zip app for example,
  4. Open file: {zip}\References\DataSources.json,
  5. Search for the displayed GUID,
  6. Press “F1” and type “Format Document” to get a nice looking JSON formatted file,
  7. Search the “Name” property inside the object that matches the GUID in the “AddinConnectorId” property.
Missing connection for a given GUID
Missing connection for a given GUID

So this is the name of the connection you are missing. Any bell rings in your head? I guess it should, as that is the only information you can find about it.

How to fix it?

If the button related to the issue is still inside your app and hopefully not replaced by anything else, or you know in which version the change was made and it is not tens of them before, you can simply click the button, then “Action->Flows” and then select to “Remove from app”:

Removing Flow connection from the PowerApps button
Removing Flow connection from the PowerApps button

Then publish new version and try again. Issue should be solved.

What if I cannot do it the easy way?

Additionally open “View” -> “Data sources” and find the not connected Flow there. Then simply remove it and again, save and publish app:

Removing missing connection from PowerApps
Removing missing connection from PowerApps

What if there is no missing connection in Data sources?

The only solution I found so far is to work on the files inside the saved locally *.msapp file. There are basically two files that usually matches the displayed GUID:

Files containing searched GUID
Files containing searched GUID
  • Properties.json – file located in a root of the msapp file,
  • DataSources.json – file located in “References” subfolder.

To begin fixes first go through the below steps:

  • Save your app locally, on your computer:
Save PowerApps locally on your computer
Save PowerApps locally on your computer
  • Change file extension from *.msapp to *.zip,
  • DO NOT UNZIP! Just open using 7zip app for example,
  • Copy the two files mentioned above outside the ZIP file.

Now you’re ready to go fixing 🙂

DataSources.json

Steps then are as following (again, using Visual Studio Code):

  • Open DataSources.json,
  • Click “F1” and “Format Document” to get a readable JSON file,
  • Search for the GUID,
  • Once found, select all object that is containing it and remove it,
Finding the missing GUID in DataSources.json file
Finding the missing GUID in DataSources.json file
  • Click “CTRL+A” to select all code of the file,
  • Again click “F1” and type “Join Lines” to again put the code in a single line.
Joining code lines into a single one in Visual Studio Code
Joining code lines into a single one in Visual Studio Code

Finally move the file back to the ZIP file, to overwrite the existing file. Done!

Properties.json

That is the second file that should be fixed. It’s a bit more complex to make this one work. Steps here are as following (using Visual Studio Code):

  • Open Properties.json,
  • Click “F1” and “Format Document” to get a readable JSON file
  • Search for the GUID,
  • It should be found inside an escaped JSON code being a value of the “LocalConnectionReferences” attribute,
  • Copy it’s value, but without opening and closing quote,
  • Paste copied text in new file,
  • Change document type to JSON,
Change document type to JSON in Visual Studio Code
Change document type to JSON in Visual Studio Code
  • Replace escaped quotes with quotes (\\" to ") to get valid JSON,
Replace escaped quotes with not escaped
Replace escaped quotes with not escaped
  • Press “F1” and “Format Document” to get a nice looking JSON structure,
  • Remove the whole block containing missing GUID,
  • “CTRL+A” to select all code,
  • Again press “F1” and type “Join Lines” to get code back to single line,
  • Again escape " replacing ” with \\",
  • Copy the code and replace the value of the “LocalConnectionReferences” attribute inside the “Properties.json” file.

Finally move the file back to the ZIP file, to overwrite the existing file. Done!

Uploading fixed file

Last step is to change back the extension of a file from *.zip to *.msapp. After doing that you’re ready to go.

Now is the time to open the new app in PowerApps designer. To do that go to the https://us.create.powerapps.com/studio/ url.

There click “Open” and “Browse” and navigate to the msapp file you would like to open:

Opening local msapp file in PowerApps
Opening local msapp file in PowerApps

After that simply wait until app is loaded. Once it is loaded, you will unfortunately need to re-configure all connection and fix issues. Finally save it as a new one (or overwrite the existing one) and then try to export it as package again. Works like a charm! 🙂

If you have any questions or comments please live them below!


Tomasz Poszytek

Hi, I am Tomasz. I am expert in the field of process automation and business solutions' building using Power Platform. I am Microsoft MVP and Nintex vTE.

16 Comments
  • Justin Baker

    Hey Tomasz,

    Great article. Very helpful. I can no longer edit files contained within the msapp file. I can pull them out and edit them then put them back inside the msapp file however Everytime I import the updated version the file I edited gets ignored and a new one generated. This happens even if I don’t change any content and just pull the file out of the msapp archive and put it back in.

    For example, if I pull out the datasources.json then put the file back into the msapp archive with the same content and import the msapp, my data sources inside the power app are gone.

    This used to work but no longer seems to. Does it still work for you?

    Thx, Justin

    July 19, 2019 at 1:43 pm Reply
    • Tomasz Poszytek

      That really sounds impossible. So if you totally remove those files from the ZIP, will they be re-created? I doubt… Since PowerApps cannot know what is inside those files, right? So how could it generate those files again. To be honest I haven’t tried that for a longer while, but still it sounds rather impossible. Have you checked, that after you updated those files in ZIP file they actually got updated before you turned that ZIP back to msapp file?

      July 19, 2019 at 3:25 pm Reply
      • Justin Baker

        I think you misunderstand. I pull them out of the archive (msapp file) to my local machine then put them back into the archive and then I upload the msapp file. Yes, datasources.json get regenerated if I modified the datasources.json file contained in the msapp. And by modified pulling it out of the msapp file and putting it back in seems to be enough. Every powerapp would need a default datasources.json, so replacing a modified datasources.json with the default one is not a far stretch. The question is what is different. It’s not the content. I didn’t change the content, but there are metadata changes.

        As best as I can tell – content wise nothing. However, the date has changed on the file and some metadata is being added by Windows 10 which persists when dragged into the zip file (msapp).

        I did another test today w. properties.json. That I actually modified more than pull out of the archive and put back in. The change I made persisted. I tested again with a control file and when I uploaded the msapp back into powerapps the screen that I modified (the control files seems to be broken up by screen, there is one for app) is now removed from the app. It makes it look like it discarded the screen control file I modified.

        I was trying to find out if you had seen the same behavior. Since the blog article was recent, I thought maybe you had done it recently.

        It used to work for me, but that was some time ago and I was only trying again in the past week. The structure of the msapp has been updated since I had it work previously as well. If you haven’t tried it in a while and are interested, try saving the msapp to your local machine. Pull out the datasources.json from the msapp archive and put it on your local machine then put it right back into the msapp file overwriting the copy in there and upload. See if your datasources persist.

        July 21, 2019 at 5:51 pm Reply
  • Blake

    WOW this was awesome thank you so much for the detailed write up. For an application wanting to not be code based seems like there needs to be more user friendly extensions added into the PowerApps module to make things like this Native. After 8 hours of troubleshooting and trying to fix this issue I ran into your article. In less than an hour I was fully functioning again.

    August 6, 2019 at 3:13 pm Reply
    • Tomasz Poszytek

      I’m more than delighted that it helped you. Thanks for sharing 😃

      August 6, 2019 at 3:42 pm Reply
  • Dileep

    This is awesome. You saved my day. Thank you so much

    April 3, 2020 at 8:39 am Reply
  • Alice

    Hello Tomasz,

    I am trying to export my app, but I get this error message.
    Could you help me?

    The specified flow “bb007d8c-1c18-43c3-92ab-544afa16d781” was deleted.

    regards

    July 7, 2020 at 12:06 pm Reply
    • Tomasz Poszytek

      Hi, this is what this post is about 🙂 You need to remove that flow from connections inside your app. Go to “Flows” inside your Power App and delete the one that was deleted in Power Automate.

      July 7, 2020 at 1:58 pm Reply
      • Alice

        Thank you very much! It works. 🙂

        July 13, 2020 at 7:27 am Reply
  • Jojie

    HI Tomasz, I am facing the same issue and this article seems helpful, however, after i’ve done all of it when I tried to upload the msapp file, I get an error file is corrupted.

    Can you specify what do you mean of “remove the whole block containing missing GUID,”?

    Thanks.

    February 19, 2021 at 1:30 pm Reply
    • Tomasz Poszytek

      Hi, I meant the key and value. So the reference to the missing datasource.

      February 21, 2021 at 4:01 pm Reply
  • Marcin Jarząbek

    Hi Tomasz,
    I have a problem with exporting the app but the error I am getting is reffering to SQL connection (shared-sql-1f73aeb2-246a-4f38-9958-a1a6-f79b6462). I created a ZIP file from msapp and looked for this reference somewhere in the code but no results were found. Could you help me understand where is the problem?

    November 9, 2021 at 10:56 pm Reply
    • Tomasz Poszytek

      That is weird… There must be that connection present in config files of your exported app. Maybe it’s in the solution? And the app is not using connections directly, but just connection references?

      November 10, 2021 at 9:20 pm Reply
  • Barry Gillard

    Hi, I have followed your instruction and located the code GUID that is causing the issue within the Properties.Json
    I am now stuck on what to do. The GUID causing the issue in 4d1ea161-9aa3-4670-8544-1f7ce5948c9c which can be found twice below. Please help
    :\”https://connectoricons-prod.azureedge.net/releases/v1.0.1534/1.0.1534.2605/logicflows/icon.png\”,\”parameterHints\”:{\”workflowName\”:{\”value\”:\”4d1ea161-9aa3-4670-8544-1f7ce5948c9c\”},\”workflowEntityId\”:{\”value\”:\”081745a4-bd22-ec11-b6e6-6045bd87ef7b\”},\”312d8a07-73d3-43c3-94b9-1cab8165fb4d\”:{\”value\”:\”shared_sharepointonline_1\”},\”d7b8549f-4655-4948-838c-dfc2b14a6c6c\”:{\”value\”:\”shared_onedriveforbusiness_1\”}},\”parameterHintsV2\”:{\”workflowName\”:{\”value\”:\”4d1ea161-9aa3-4670-8544-1f7ce5948c9c\”},\”workflowEntityId\”:{\”value\”:\”081745a4-bd22-ec11-b6e6-6045bd87ef7b\”},\”shared_sharepointonline_1\”:{\”value\”:\”312d8a07-73d3-43c3-94b9-1cab8165fb4d\”},\”shared_onedriveforbusiness_1\”:

    March 3, 2022 at 4:51 pm Reply

Post a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.