web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PCF debugging in CDS e...
Power Apps
Answered

PCF debugging in CDS environment

(0) ShareShare
ReportReport
Posted on by 30

Hey,

 

I am looking for debugging option for my PCF control inside CDS environment. Actually due to my complex logic I am wondering if possible to debug my code with CDS environment (not inside harness)?

 

Or can we make webapi call while in harness dev environment?

 

Regards,

Awais 

 

I have the same question (0)
  • Ben Thompson Profile Picture
    1,400 on at

    Any reason why you can't just add debugger statements within your code and open Developer Tools? With the developer tools open the javascript will pause when the debugger statement is hit.

  • awais Profile Picture
    30 on at

    Thanks @ben-thompson

    when we deploy code on CDS as bundle file( single javascript file) and if we have debugger line in it but still we can't understand javascript due to minified code.

     

  • Verified answer
    ScottDurow Profile Picture
    1,039 on at

    The most common approach is to use Fiddler to serve up a development build of your PCF component and then load up the Model Drive/Canvas App page as normal - but the PCF bundle.js will be served from your local machine rather than the deployed version.

     

    See:

  • Verified answer
    david_rivard Profile Picture
    42 on at

    Hi there is a good video that helped me achieve what you want: 

    https://www.youtube.com/watch?v=Ov-m5FBUj9g

     

    Maybe there are better ways but this is how I do it:

     

    1-  modify :  ..node_modules\pcf-scripts\webpackConfig.js

    add at line 36 : 

    devtool: "source-map",  //Add this line to produce a source map (bundle.js.map) in the output folder
     
    2- modiy : tsconfig.json
    add line in bold
    {
        "extends""./node_modules/pcf-scripts/tsconfig_base.json",
        "compilerOptions": {
            "typeRoots": ["node_modules/@types"],
            "sourceMap": true
        }
    }
     
    3- Build your PCF
    **You should now have a file called bundle.js.map in your 'out' folder , keep that path in mind you will need it later
     
    4- Deploy your PCF to the target environment
     
    5- Using Fiddler, setup an AutoResponder rule
    Add an Autoresponder rule
    Map : bundle.js.map
    To :   {PCFFolder}\out\controls\{PCFNAME}\bundle.js.map
     
    You should now be able to debug your actual typescript file as is.
     
     
     
  • ScottDurow Profile Picture
    1,039 on at

    Using the standard web-pack config output by pac pcf init - building in development mode using tsc start watch - you should automatically get the source maps included in your bundle.js

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    I agree with  @ScottDurow 

    Using the default webPack Settings, and uploading using "pac pcf push" you get a debug version (including the source-maps).

    To find the code, I use in Chome "CTRL + P" and search for my component name, since this is included in the name path. That way I get the index.ts

    image.png

     

    After that you get the structure of your component in the Pages-Tab, and can make breakpoints as you wish:

     

    image.png

     

    Regarding requests inside Harness, I "mock" the requests. Without using tools for mocking, I decide (for now) based on window title or based on  window.PCFUtilities if it's a request made inside the Harness or not, and return default/test values. (That's of course not recommended by the sdk, but in the worst case I have to delete this later on and I'm supported).

    Hope it helps.

    Best regards,

    Diana

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard