Today, an error in a Power Apps code app means that you have to search and trace the exception logs and filter them manually. There is no out-of-the-box way to track the errors (exceptions) in a code app.
In this series of posts I set up the foundation for automated CI/CD of a code app. The error messages from the app go into the issue tracker of the repo, so that AI code agents (set up in Foundry) can patch them later and open a merge request.
The first two guides get the errors out of the app and store them, in Application Insights / in a Dataverse table. The next posts turn a stored error into an issue in GitHub or GitLab.
From an error in the app to git work items

Nothing sends the errors of a code app to you, so the app has to pick up these errors itself:
- An error that no code caught (for example a click handler that throws).
- A promise that no code handled (for example a request the app started and never checked).
- A Dataverse or connector call that fails. The generated service does not throw. It returns
success: false, so the browser sees no error.
With Application Insights:
- The app catches the error. The Application Insights SDK picks up the uncaught errors and the unhandled promises, and a small function called
logIfFailedpicks up the failed calls. - The app sends the error to an address in Azure. The environment has to allow that address first.
- Application Insights stores the error. You find it in the Azure portal a few minutes later.
- An alert rule in Azure starts a Logic App, and the Logic App creates an issue in GitHub or GitLab.
With a Dataverse table:
- The app catches the error. Two event listeners pick up the uncaught errors and the unhandled promises, and the same
logIfFailedpicks up the failed calls. - The app writes a row to a table called App Error, as the signed-in user. The security role of the user has to allow that first.
- Dataverse stores the row. You find it in the table within seconds, and a job deletes the old rows.
- A Power Automate flow starts as the row is added and creates an issue in GitHub or GitLab.
Application Insights / Dataverse table
| Application Insights | Dataverse table | |
|---|---|---|
| You need | An Azure subscription | The Create privilege on the table for every user, and a clean-up job |
| Change in the environment | The Content Security Policy has to allow an address in Azure | None |
| Time until you can see the error | 1 to 4 minutes | Seconds |
Choose Application Insights if you have an Azure subscription and want the errors next to the platform’s own metrics (the app start and every network request). Choose the Dataverse table if you want to stay inside Power Platform.
The series sets up the basics. For a production app you can also upload source maps, so the stack in an issue shows your own code, and send the app version with each error.
Posts in the series
Log the errors

Leave a Reply