[Question] Webdev Scripting

I am getting an error when trying to run a script using the webdev module.

IGN Version: 8.0.0-beta0 (b2018112002)
OS: Windows 7 (VMWare)
java -version
java version “1.8.0_152”
Java™ SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot™ 64-Bit Server VM (build 25.152-b16, mixed mode)

Script:
HTTP Method: doGet
No authentication or HTTPS

	try:
		returnString = ""
		tags = system.tag.browseTags(parentPath="")
		for tag in tags:
			returnString = returnString + "," + tag.name
			
	except Exception, ex:
			return {'json': '{"Error": "%s"}' % ex.message }
			
	return {'json': returnString }

Error shown when calling from browser

HTTP ERROR 500

Problem accessing /system/webdev/TAG_JSON/BrowseTags. Reason:

    Traceback (most recent call last):
  File "<TAG_JSON/BrowseTags:doGet>", line 4, in doGet
  File "<TAG_JSON/BrowseTags:doGet>", line 4, in doGet
	at com.inductiveautomation.ignition.gateway.script.LegacyGatewayTagUtilities.getTagProvider(LegacyGatewayTagUtilities.java:129)
	at com.inductiveautomation.ignition.gateway.script.LegacyGatewayTagUtilities._browseTags(LegacyGatewayTagUtilities.java:280)
	at com.inductiveautomation.ignition.gateway.script.LegacyGatewayTagUtilities.browseTagsImpl(LegacyGatewayTagUtilities.java:248)
	at com.inductiveautomation.ignition.common.script.builtin.LegacyTagUtilities.browseTags(LegacyTagUtilities.java:117)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Tag provider 'null' could not be found

Based off of the provided stacktrace and the existing documentation from 7.9/8.0, you should attempt to provide the name of your tag provider in square brackets at the beginning of the parentPath argument.

Try using
tags = system.tag.browseTags(parentPath="[providerName]")
and see if that gets you what you need.

Update: tags = system.tag.browseTags(parentPath="[providerName]") worked for me after I was able to replicate your behavior.

1 Like

I confirm that adding the [providerName] solves the issue, just as an observation in previous version this was not needed, the [default] provider was assumed when omitted.