Loading...

Debugging Canvas App PCF components with fiddler

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,

@ScottDurow

Published on:

Learn more
Develop 1 - Dynamics 365 Architecture Services
Develop 1 - Dynamics 365 Architecture Services

Share post:

Related posts

Power Apps – Create offline profiles in the maker studio for Canvas apps

We are announcing the ability to create offline profiles in the maker studio for Canvas apps in Power Apps. This feature will reach general av...

10 days ago

Power Apps – Manage your source code for canvas apps

We are announcing the ability to manage your source code for canvas apps in Power Apps. This feature will reach general availability on Septem...

10 days ago

Embedding Canvas Apps into Model-Driven Forms for a Unified Experience

In Microsoft Power Apps, there are two main application types—canvas apps and model-driven apps—each serving unique purposes. While model-driv...

1 month ago

Canvas App Error: “Row Size Exceeded” – Causes, Fixes, and Best Practices

When building Canvas Apps with Dataverse, you might see this error: The total size of the columns used in the database command exceeded t...

1 month ago

Dynamics 365 Field Service : Create task-specific canvas apps and custom pages

Field technicians are the backbone of any service-centric organization. But their success depends on having the right tools at their fingertip...

1 month ago

Automating UI Testing for Canvas Apps with Power Platform Test Engine

Canvas Apps in Power Platform provide a flexible way to build rich, custom user interfaces using a low-code approach. However, as these apps g...

2 months ago

User-Defined Function (UDF) in Power Apps Canvas App – EMI Calculator Example

In this blog you will know about User-Defined Function (UDF) in Power Apps Canvas App with a EMI Calculator Example Watch the video below or s...

2 months ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy