Debugging Canvas App PCF components with fiddler
Those of you who know me will also know that I am a massive Fiddler fan for removing the need to deploy each time you change your JavaScript source.
Here are some of my previous blog posts on Fiddler - http://develop1.net/public/search?q=fiddler
The PowerApps docs now even include instructions on it https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/streamline-javascript-development-fiddler-autoresponder
Developing PCF Canvas Controls
When developing PCF controls for Canvas Apps, the process is slightly different and includes an extra step.
1. Add an autoresponder in the format:
Resources0Controls0<NamesSpace>.<ControlName>.bundle.js?sv=
E.g. Resources0Controls0Develop1.PCFTester.bundle.js?sv=
It should look something like:

2. Since the scripts are served from a different domain to PowerApps, configure Fiddler to add the Access-Control-Allow-Origin header.
In fiddler, Press Ctrl-R to open the rules editor.
Locate the OnBeforeResponse function and add:
if (oSession.oRequest.headers.Exists("Host") && oSession.oRequest.headers["Host"].EndsWith("windows.net")) {
if (oSession.oResponse.headers.Exists("Access-Control-Allow-Origin")){
oSession.oResponse.headers["Access-Control-Allow-Origin"] ="*";
}
else{
oSession.oResponse.headers.Add("Access-Control-Allow-Origin","*");
}
}
It should look something like:

When you add in your PCF Component to the Canva App, it should now be loaded from your local file system just like it does with Model Driven Apps. To refresh the component, you will need to exit the app and re-open (rather than just refresh the window in Model Driven Apps).
Hope this helps,
Published on:
Learn moreRelated posts
High severity vulnerability in pcf-scripts package due to dependency on xml2js
Have you noticed recently that when you run npm install on your PCF projects, you get a high severity vulnerabilities error (or maybe you...
First look at PCF dynamic schema object outputs
One of the new features now supported in PCF (Power Apps Component Framework) code components are 'object outputs'. A PCF component has a mani...
Power Fx delegation of 'in' operator against Davaverse
Delegation of queries in Canvas Apps/Custom Pages has long been a troublesome topic and we are always looking out for the triangle of doom, or...
Perform ExecuteMultiple in batches and changesets from TypeScript using dataverse-ify version 2
My free tutorial course on writing Dataverse web resources has been available for over a year now, and it has had over 1000 people enrol! The ...
Perform complex Dataverse FetchXml queries using Power Fx (from a Canvas App)
One of the constant challenges we face when writing canvas apps and custom pages using Power Fx is ensuring that the queries we use are always...
How to update multiple records in a model-driven app grid using Power Fx commanding
If you wanted to add a button to a command bar to perform an update on multiple records in a grid, you can easily create a formula that result...
Power Apps ESLint plugin replaces Solution Checker for TypeScript code
The Power Apps team have had a long-standing quality tool called the Solution Checker. This was built into the Dataverse solution management i...
Dataverse for Teams vs Canvas Apps - Part 1 - Checked vs Default Control Properties
If you were thinking that Power Apps Canvas Apps and Dataverse for Teams Canvas Apps are just the same – but with a different license an...
Canvas app code component error "Couldn't import components"
If you are developing code components (PCF) for canvas apps you'll be used to using the 'Get more components' panel. When adding the code-comp...
'ComponentFramework' is not defined - eslint with pac pcf init
At some point, over the last few months, a change was introduced to the Power Platform CLI such that if you have the ESLint VS Code add-in ins...