I have a canvas Power App and multiple Power Automate Flows in a Solution. The Solution was used to migrate the app and flows from dev env to prod env.
Originally the solution utilized environment variables. The original solution was created a while back and I don't recall why I decided to delete the environment variables from the solution but I did and republished the Solution sans env vars. I then successfully published the solution and imported it into the production environment without issue. Although the Solution was successfully migrated to the prod env a few months ago, out of the blue it threw this error when users tried to access the app yesterday.
"Sorry, we didn’t find that app." & "The value for environment variable 'new_shared_sharepointonline_6763ce11d8f1456b833d6bb506bab82a' was not found in the environment."
When comparing the DEV vs PROD env Solutions, I also noticed there was a missing Office 365 Outlook connector in the PROD env so I added the missing Office 365 Outlook connector. Next, I edited the Power App and while it had a Office 365 Outlook connector, I deleted it and added it back just to be sure. But when I saved and tried to publish, it threw this error.
"Didn't publish."
"The request failed with error: '{"error":{"code":"0x8004f036","message":"The dependent component EnvironmentVariableDefinition (Id=new_shared_sharepointonline_6763ce11d8f1456b833d6bb506bab82a) does not exist. Failure trying to associate it with CanvasApp (Id=412c60a3-0091-489f-b123-51508179289d) as a dependency. Missing dependency lookup type = EntityNameLookup."}}'. The correlation Id is '2914bd16-5d4b-461a-a389-4d3ef7c2642f'."
So I can't publish the new version and users can't access the app in the prod env. If I can't ge this resolved, then I think I have to create a new solution (no env vars) and add back the app and flows. Then delete the Solution in the prod env and import the new Solution.
The other clue is the prod canvas app has no dependencies. Any recommendations?
Thank you @BhaskarDhone for the great information. I got it worked out using these steps.
DEV
1. Delete existing solution:
a. Remove each Flow one at a time from the Solution
b. Remove Power App
c. Delete env vars (delete all except '**** DEV')
d. Remove connections (not delete)
2. Create new '**** App' solution and add canvas app
3. App update to 'Add env vars when data src added', remove and add back data sources
4. Add 6 Flows
5. Export New Solution
PROD
1. Delete existing solution:
a. Remove each Flow one at a time from the Solution
b. Remove Power App
c. Delete env vars (delete all except '**** DEV') - No env vars present
d. Remove connections (not delete)
e. Delete the Solution
2. Delete the Flows from env
3. Delete the app
4. Import new solution
5. Publish app
It seems your application was using SharePoint connection environment variables. Try to follow below steps.
1. Edit application
2. Remove all datasource and add it again. While adding make sure it should create environment variable automatically.
Follow this articles
Use data source environment variables in canvas apps - Power Apps | Microsoft Learn
3. Publish the app.
4. Go to solutions , click on three dots --> Advanced --> Add Required Objects
This will add if any connection reference is missing.
Do the same for other components like power automate , powerapps etc. ( From step1 to Step 4)
5. Publish All customization
6. Export Solution
7. Import Solution , during import it will prompt from providing values for connection reference. Select pro specific values.
This should solve your problem.