Select to view content in your preferred language

Issues in adding custom widget in experience builder

2971
8
08-17-2023 04:03 AM
Labels (2)
NehaKshirsagar1
Emerging Contributor

Hi, I am getting issues in adding custom widget in experience builder 11.1 version.

Custom widget is working fine in developer version of Experience builder. However , it gives me errors whenever I deployed same widget & using in Experience Builder Application. 

I have used exactly same process as given in documentation.

Process : 1. https://www.esri.com/arcgis-blog/products/arcgis-enterprise/developers/add-experience-builder-custom...

2. https://doc.arcgis.com/en/experience-builder/11.0/configure-widgets/add-custom-widgets.htm

Looking forward to your positive response.

@RobertScheitlin__GISP 

 

0 Kudos
8 Replies
CamMuller
Esri Contributor

Hi @NehaKshirsagar1 - can you please give further context and information to the issues/errors you are receiving?

0 Kudos
NehaKshirsagar1
Emerging Contributor

Hi @CamMuller, Please check this screenshot for the error I am getting for deployed custom application .. It throws an Error: Cannot read properties of undefined {reading featureLayer}

 NehaKshirsagar1_0-1692271605347.png

Same code is running as expected in Experience Builder developer version 

NehaKshirsagar1_1-1692272098486.png

 

 

0 Kudos
JeffreyThompson2
MVP Frequent Contributor

Some things to check:

  1. Your manifest.json indicates Experience Builder 1.12, but Enterprise 11.0 is on Experience Builder 1.8. If you are not using features from the latest versions of the Javascript API, consider downgrading your required version in the manifest.JeffreyThompson2_0-1692278867425.png

     

  2. The error indicates that your widget is expecting a featureLayer and can't find it. Maybe you need to add the map to the experience before you add your table widget.
  3. Make sure you do not have any naming conflicts with between your widgets or with any ESRI widget. I created a custom BasemapGallery that broke when ESRI released their version. To clear the error, I had to remove my widget from the Experience Builder folder structure, rename it, stop the server, re-add it to the Experience Builder directory, and restart the server.
GIS Developer
City of Arlington, Texas
NehaKshirsagar1
Emerging Contributor

Hi @JeffreyThompson2 ,

I have tried with changing version in manifest , added Map/featureLayer in map and then tried with widget; However, I am still facing this error. Error: Cannot read properties of undefined {reading featureLayer}

NehaKshirsagar1_0-1692283474809.png

It would be great if you please help me in this issue.. 

0 Kudos
JeffreyThompson2
MVP Frequent Contributor

I don't know if I can get to the bottom of this, but here are some more things to look into.

  1. You said that this code is working in your local developer environment, but not on Enterprise. Are you sure that the code in both places is exactly the same? If so, think about what may be different about these environments.
  2.  Open up your developer tools and find what line of code is throwing the error. Start your investigation there.
  3. Does the error occur immediately after adding the widget to the Experience or does it happen after some sort of interaction? Does it run in Preview mode?
  4. Looking at some of your code I assume you copied the ESRI table widget as the base for your widget. Are you sure if it is backwards compatible with the earlier API version? There have been some pretty big changes to the API lately.
  5. My linter is detecting many potential errors in your setting.tsx file. Sometimes the linter is wrong, but not often. Some lines I am especially suspicious of causing problems: JeffreyThompson2_0-1692286286220.png

     

    JeffreyThompson2_1-1692286310463.pngJeffreyThompson2_2-1692286451796.png

    Seeing the linter flag brackets and javascript reserved words is a big red flag of some sort of syntax error.

GIS Developer
City of Arlington, Texas
0 Kudos
NehaKshirsagar1
Emerging Contributor

Hi  JeffreyThompson2,

I am trying to install developer version of experience builder 1.8 to check the widget code ; However, it's not letting me use it with cross-env issue.

NehaKshirsagar1_1-1692351414882.png

Tried with fresh installing of 1.8 version is having error in client server illustrated below :

NehaKshirsagar1_2-1692351601148.png

Please help me in resolving this problem.

 

0 Kudos
JeffreyThompson2
MVP Frequent Contributor

Did you download the 1.8 software package and run npm ci? Are you trying to load other custom widgets from higher versions?

More fundamentally, what is your goal with this widget? What can your widget do that the default table widget can't? Could you build your widget from scratch or the javascript API? I often find starting fresh to be easier than trying to modify ESRI's code.

GIS Developer
City of Arlington, Texas
NehaKshirsagar1
Emerging Contributor

Hi Jeffrey,

I will be trying to rebuild the widget again in Experience Builder 1.8 version..  

 

 

 

 

0 Kudos