Help needed for a widget. Invalid syncedState value

I can use my widget just fine, both in dev and in prod, but when other people try to drag it onto a canvas they get the following error.

Error: in setSyncedState: Invalid syncedState value for widgetID=1255306792807530830 name=name value=undefined
at (PLUGIN_5_SOURCE:260)

Why does this work for me but not other people and what can I do to fix it? Any help would be appreciated.

Check line 260 of your widget.

I found the problem but haven’t fixed it yet. I was doing this “figma.currentUser.name.split(/\s*,\s*/)[1]” which worked for my name but not for others. it is assuming the format of people’s names and not all names match the format of mine.

Yea was doing it but it really didn’t have to do with line 260 :slight_smile:

You probably checked this line in the .tsx file, but you should have done it in the compiled .js file.

Possibly :P. It did give enough info to start troubleshooting though. I was using the second value after splitting up the string. Some people don’t have a comma separated name so their name didn’t have a second value after the split. I needed more conditional in there or in my case I just took out the split for now and used the whole username.