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-scripts] [Error] ...
Power Apps
Unanswered

[pcf-scripts] [Error] encountered unexpected error: Error

(1) ShareShare
ReportReport
Posted on by 8
Hi. I'm fairly new to PCFs but have worked through some tutorials and successfully created controls both with and without React. I don't find the framework particularly complicated, but do have a technical hurdle, the solution of which is certainly trivial, but which I have not been able to solve so far.

My problem is: whenever I work with promises, I get the following error from the TS compiler (more precisely: pcf-scripts build):

[10:56:39] [build] Initializing...
[10:56:39] [build] Validating manifest...
[10:56:39] [build] Validating control...
[10:56:39] [build] Generating manifest types...
[10:56:39] [build] Generating design types...
[10:56:39] [build] Running ESLint...
[pcf-scripts] [Error] encountered unexpected error:
Error
 
For example, the following test call in the init method:
 
public init(
  context: ComponentFramework.Context<IInputs>,
  notifyOutputChanged: () => void,
  state: ComponentFramework.Dictionary
): void {
  const eventName = context.parameters.EventName.raw;
  if (eventName) {
    const paOneGridCustomizer: PAOneGridCustomizer = { cellRendererOverrides, cellEditorOverrides };
 
    context.webAPI.retrieveRecord("account", "some uuid here").then(() => {
      // This is just a placeholder for the test function
    console.log("Record retrieved successfully");
    });

  }
}
 
As soon as I comment out the call to retrieveRecord, the build process goes through:
 
public init(
  context: ComponentFramework.Context<IInputs>,
  notifyOutputChanged: () => void,
  state: ComponentFramework.Dictionary
): void {
  const eventName = context.parameters.EventName.raw;
  if (eventName) {
    const paOneGridCustomizer: PAOneGridCustomizer = { cellRendererOverrides, cellEditorOverrides };
 
    // context.webAPI.retrieveRecord("account", "some uuid here").then(() => {
    //  // This is just a placeholder for the test function
    // console.log("Record retrieved successfully");
    // });

  }
}
 
I do not have problems with promises in other scripts, mainly OnLoad and OnChange event handlers in D365 forms. 
 
Any ideas what I'm doing wrong here?
 
Thanks in advance!
Michael
 
 
 
 
 
I have the same question (0)
  • Vahid Ghafarpour Profile Picture
    697 Super User 2025 Season 2 on at
    I had same problem when missed webAPI reference in Manifest
    In your ControlManifest.Input.xml, ensure you've included this line under <feature-usage>:
     
    <feature-usage>
      <uses-feature name="WebAPI" required="true" />
    </feature-usage>
     
  • MH-16081421-0 Profile Picture
    8 on at
    Thank you Vahid. I tried it before but it did not fix the issue. I wonder if there is any log file generated in the build process that may contain additional information. 
  • MH-16081421-0 Profile Picture
    8 on at
    It is related to the node modules. I downgraded them to older versions found in another PCF control. With that change, the build succeeds. Some of them show vulnerabilities, 15 of them even high. At least I have a working base solution and can try upgrading these modules one by one later.

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard