Part 4: Common Pitfalls, Snags, and Issues When Creating UIB Components 


When working with the SN-CLI and developing custom components, we’ve encountered some odd issues! Here are some common errors you may encounter and how we’ve resolved these in the past. We’ll do our best to update this with any new issues we encounter and their solutions if we can resolve them. Feel free to contact us with any issues (and or solutions) you may have! 

SN-CLI Connecting to the wrong instance/Using the Incorrect Profile 

We still don't have an exact answer as to why this happens, but it has happened to us many times. It seems like the instance URL is saved/cached, and the CLI tries to use it even though it might not exist in any of the profiles you've created. Below are some steps we take if it keeps trying to connect to the wrong instance: 

  1. Try killing and resetting your node processes 

  • NOTE: The command killall node only works for MacOS.  

  • For Windows you can try navigating to the command prompt and running “taskkill /im node.exe” if this doesn’t work you could try forcing the command “taskkill /f /im node.exe” 

This may resolve the issue, but if it doesn't, then try checking the instance assigned to the profile you are using by typing the following into your terminal to see the list of profiles. 

  • snc configure profile list 

  • a list like this should appear, if you have a couple profiles set, this is how it might look: 


  • "default": { 
        "appversion": "", 
        "host": "https://<INSTANCE-NAME>.service-now.com", 
        "hostversion": "", 
        "loginmethod": "basic", 
        "output": "json", 
        "username": "user.name" 
    }, 
    "new-instance": { 
        "appversion": "", 
        "host": "https://<INSTANCE-NAME-2>.service-now.com", 
        "hostversion": "", 
        "loginmethod": "basic", 
        "output": "json", 
        "username": "admin" 

 

  1. Check to make sure the instance you are trying to connect to is assigned to one of the profiles on the list. If it is not, add it with this: 

  • snc configure profile set --profile profile-name 

  • Make sure to replace profile-name with whatever name you want to name the profile. After verifying that one of your profiles has the instance you are trying to use, try using the --profile command to use the appropriate profile and instance. ex: 

  • Using the profile from the example list above 

  • snc ui-component develop --profile new-instance 

  • OR 

  • snc ui-component deploy --profile new-instance 

  • using the deploy or develop command without the --profile attribute will result in the cli using the default profile.  

  1. If the cli is still using the wrong instance name after these steps, try refreshing the connection 

  • snc configure profile refresh --profile new-instance 

If after refreshing your connection, the cli is still pointing to the wrong instance, there are still a couple more things to try.  

2. Try relogging into the instance you are trying to use 

  • snc ui-component login {instance_url} basic {username} "{password}" 

3. After this, you should try to run develop or deploy again. Still seeing that old instance name and not the one you are trying to use? then last thing to try is to delete all of your profiles, even the default one: 

  • # using the profiles from the example list above 
    snc configure profile remove --profile new-instance 
    snc configure profile remove --profile default 

  • typing the profile list command should now display an empty list.  

 

Set up a new profile like before and then use the killall node command again, maybe even restart your VSCode applicaiton just in case. After all that, try the develop or deploy.  

With any luck, this should hopefully connect you to the right instance! If you made it this far into troubleshooting your instance connection, I am sorry. 

 

Not seeing your deployed component on UI Builder 

After successfully deploying your component, you attempt to use it on UI Builder and you can't find it but someone else with access to your instance can see and use it. This issue has happened a couple times where the one who deployed the component can't seem to find and use the component.  

  • A quick fix is to go to the filter navigator in your instance and type cache.do. 

  • Then log out and back into your instance.  

  • When you navigate back to UI Builder and the page you want to add the component to, you should see your component in the components list! 

 

Node version issues 

The SN-CLI is a little finnicky when it comes to versioning...and it’s generally running on older releases of the prerequisites listed in our Prerequisites.

  • If you run into issues, check your node version by typing “node -v” in your Terminal (MacOS) or Command Prompt (Windows) 

  •  I’m running v14.17.6 which is working well for me! 

  • To resolve an issue due to using a non-compatable node version you can do the following: 

  • Install the version you’d like to use 

  • “nvm install 14.17.6” 

  • Update the node version being used 

  • “nvm use 14.17.6” 


Previous
Previous

Part 5: SN-CLI Cheat Sheet 

Next
Next

Part 3: How to Manage Your SN-CLI Profiles