How to change WAB config.json for an app

1548
3
10-25-2016 02:56 PM
JoeMinicucci
New Contributor II

Im building a Dojo widget in WebAppBuilder using a settings page to initially set the state of the config.json object's properties. The settings page works and the widget opens. Now I changed my config.json from one state to another:

From:

{
    "id": "6c821ced4fc34a29b5b3bb98c9e05db2",
    "cssMapping": {
        "InputField": "inputField"
    },
    "hierarchyLevels": [],
    "servicePath": ""
}

to:

{
    "id": "6c821ced4fc34a29b5b3bb98c9e05db2",
    "cssMapping": {
        "InputField": "inputField"
    },
    "hierarchyLevels": []
}

I only omitted service path. This created major problems for me. Now after initializing the app I receive a very obscure stack trace:

init.js:113 Error: uniqName_6 template:config.serviceUrl(…) "Error: uniqName_6 template:config.serviceUrl
at Object.<anonymous> (https://js.arcgis.com/3.17/init.js:372:222)
at https://js.arcgis.com/3.17/init.js:63:209
at https://js.arcgis.com/3.17/init.js:376:308
at RegExp.[Symbol.replace] (native)
at String.replace (native)
at Object.q.substitute (https://js.arcgis.com/3.17/init.js:376:156)
at Object._stringRepl (https://js.arcgis.com/3.17/init.js:372:107)
at Object.buildRendering (https://js.arcgis.com/3.17/init.js:373:182)
at Object.create (https://js.arcgis.com/3.17/init.js:350:18)
at Object.postscript (https://js.arcgis.com/3.17/init.js:348:475)
----------------------------------------
rejected at a (https://js.arcgis.com/3.17/init.js:108:174)
at h (https://js.arcgis.com/3.17/init.js:107:452)
at k (https://js.arcgis.com/3.17/init.js:107:205)
at g.w.reject (https://js.arcgis.com/3.17/init.js:109:488)
at Object.<anonymous> (https://devbox.intranet.softwarecompany.com:3344/webappbuilder/apps/8/jimu.js/WidgetManager.js?wab_d...)
at https://js.arcgis.com/3.17/init.js:63:209
at h (https://js.arcgis.com/3.17/init.js:107:279)
at k (https://js.arcgis.com/3.17/init.js:107:205)
at g.resolve (https://js.arcgis.com/3.17/init.js:109:280)
at Object.<anonymous> (https://devbox.intranet.softwarecompany.com:3344/webappbuilder/apps/8/jimu.js/WidgetManager.js?wab_d...)
----------------------------------------
Error
at g.then.c.then (https://js.arcgis.com/3.17/init.js:110:97)
at Object.<anonymous> (https://devbox.intranet.softwarecompany.com:3344/webappbuilder/apps/8/jimu.js/BaseWidgetPanel.js?wab...)
at Object.forEach (https://js.arcgis.com/3.17/init.js:70:348)
at Object.loadAllWidgetsInOrder (https://devbox.intranet.softwarecompany.com:3344/webappbuilder/apps/8/jimu.js/BaseWidgetPanel.js?wab...)
at Object.startup (https://devbox.intranet.softwarecompany.com:3344/webappbuilder/apps/8/jimu.js/BaseWidgetPanel.js?wab...)
at Object.m (https://js.arcgis.com/3.17/init.js:155:344)
at Object.startup (https://devbox.intranet.softwarecompany.com:3344/webappbuilder/apps/8/jimu.js/OnScreenWidgetPanel.js...)
at Object.openPanel (https://devbox.intranet.softwarecompany.com:3344/webappbuilder/apps/8/jimu.js/PanelManager.js?wab_dv...)
at Object.<anonymous> (https://devbox.intranet.softwarecompany.com:3344/webappbuilder/apps/8/jimu.js/PanelManager.js?wab_dv...)
at https://js.arcgis.com/3.17/init.js:63:209"

I tried to delete the widget from C:\<WABROOT>\client\stemapp\widgets\<APP_NAME> as well as C:\WebAppBuilderForArcGIS\server\apps\<App#>\widgets\<APP_NAME> and also looked for config entries in C:\WebAppBuilderForArcGIS\server\apps\8\configs\<APP_NAME> (<APP_NAME> didn't exist);; and run both Grunt-clean/sync/watch...The app is totally broken now, and in the future I need to be able to edit config.json as I develop. Can anyone help? There seems to be some cached entry of config.json that is causing a problem.

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Joe,

   So what is your widget development workflow. The one that I use consistently is start basic boilerplate development in [install dir]\client\stemapp\widgets. Then create a new app for further development (i.e. app name  widget x) then I add the new widget to that app. All further code changes and work now occurs in the [install dir]/server/apps/[app #]/widgets/widgetX folder and changes to the config now have to be made to the [install dir]/server/apps/[app #]/configs/widgetX/config_widgetX.json AND the [install dir]/server/apps/[app #]/widgets/widgetX/config.json (so that when I copy the [install dir]/server/apps/[app #]/widgets/widgetX back to the [install dir]\client\stemapp\widgets folder for new apps, it has the same changes in the config.json).

It sounds like you have some code in the Widget.js or the Settings.js that is still referencing servicePath. Normally I have code that checks for the existence of the config property before I try and use it in my code.

0 Kudos
JoeMinicucci
New Contributor II

Robert, my config is never reflected within [install dir]/server/apps/[app #]/configs/widgetX/config_widgetX.json ..In fact the corresponding sub-folder is never created. Our workflows are basically the same except I develop my widget outside of the WAB install root and run the provided ESRI Grunt scripts to keep the files concurrent throughout. I have checked manually in the outlined directories to insure that there is no stale configurations. It doesn't appear the property is used anywhere in the JS/HTML however the widget can't initialize without it.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Joe,

 OK. What do you mean by 

except I develop my widget outside of the WAB install root

The [install dir]/server/apps/[app #]/configs/widgetX/config_widgetX.json will never be created if you do not make a settings change to the widget inside WAB.

0 Kudos