Select to view content in your preferred language

WAB widget icons don't appear when I download the app on to the server. The icons appear just fine in the WAB. Please let me know if you have experienced this issue and if there is a solution!

3568
16
10-23-2019 09:23 AM
NoraKennedy
Emerging Contributor

The png icons do not appear when I access the URL after downloading the app on to the server.

Tags (1)
16 Replies
ForamDoshi
New Contributor

So, I was able to fix the problem and it was very simple and silly issue. The image I copy pasted was .jpg file and webappviewer was looking for 'icon.png'. I just had to change the image type 🙂

0 Kudos
Brian_Wilson
Honored Contributor

We're seeing this now with WABDE version 2.24. It inserts an icon line for each widget that references the dev environment. (has webappbuilder/apps/17 in the icon entries)

To my knowledge it's never happened before to us. The previous config.json files did not have the "icon" set on the widgets and now they do, with the wrong URL in them.

I am pretty sure I could go through the config and remove each and every "icon" line from each widget to make it work but what a pain that would be.

I am wondering if there is a setting now that I need to adjust to stop it from adding the optional icon line to the config.json file.

Referring to the "config-readme.txt" file, it says

//Optional. If not set, use the icon in widget folder.
"icon": "",

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

@Brian_Wilson 

delete the whole "icon": "", don't just set it to an empty string.

0 Kudos
Brian_Wilson
Honored Contributor

Thanks, I understand that, but why is wabde adding "icon" entries now? Is this a setting that changed?

I want my non-JSON literate co-workers to continue updating apps without having to edit the config.json manually for them on each deployment.

 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Yep this is something new'ish. There is no way to disable it that I am aware of.

0 Kudos
Brian_Wilson
Honored Contributor

You're only saying that because you're not an Esri employee.

I am going to open a support ticket on it. Seems like a pretty serious bug to me. Thanks again.

For anyone else who hits this bug, I went ahead and deleted every "icon": line from the deployed config.json to test it and it did indeed fix it.

It would probably be possible to construct a rewrite rule in IIS to catch it and return the correct URL but that too would be a pain.

 

 

0 Kudos
Brian_Wilson
Honored Contributor

I have a call in now to Esri but there was no immediate solution. (I gave them a link to this posting too.)

We're not planning on keeping WAB around forever so I don't really want to troubleshoot this. I was briefly tempted to dig into the javascript that creates the problem but then I'd just be working for Esri for free.

We don't publish from WABDE every day. So I built a workaround for it.  I will give my team a script similar to this, which can be run after deployment. This version strips out the stupid "icon" lines and spits the repaired JSON code out to STDOUT (eg prints it). If anyone else hits this bug maybe this will help you too. I haven't decided what the final version will look like but this does the job for now. I will probably add code to make it into a filter (make a backup file and overwrite the config.json file) and stick it in a Python toolbox.

"""
 Read a config.json file and remove the weird references to icon.png files.

 Give me a filename and I will repair the file and spit the new data out to STDOUT.
 Give me nothing and I will run a unit test
"""
import sys
import re

def do_work(data):
    previous_line = None
    re_search = re.compile(r'"icon":\s+\"/webappbuilder')

    for line in data:
        line = line.rstrip() # Remove newline
        if previous_line:
            if re_search.search(line):
                # drop this line and remove the comma from the previous line
                if previous_line.endswith(','):
                    previous_line = previous_line[:-1]
                line = None # this line will be dropped
            print(previous_line)
        previous_line = line
    if previous_line:
        print(previous_line)

if __name__ == "__main__":

    # unit test
    test_data = [
        "1 remove comma from this line,",
        '2 "icon": "/webappbuilder  this line should get dropped',
        "3 some text,",
        '4 "icon": "webappbuilder this line should not match so it should be in output',
        "5 last line"
    ]

    try:
        config = sys.argv[1]
        with open(config, "r") as fp:
            config_data = fp.readlines()
        do_work(config_data)
    except:
        print("Running tests")
        do_work(test_data)

 

Now on to more interesting problems... Cheers.