additionalScope is becoming null in query

There appears to be a problem with this, in that the undefined variable inserts the text 'null' into the query. I'm using a REST query, with groups/{{groupName}}. My REST Api will accept a request without a value for group name (e.g. groups/), but if the name is specified, it must be valid or the request will error.

As noted in the post, the groupName is shown in red with 'groupName is not defined'. I've tried variations on testing the value for null, but all it does is translate to a REST call with the word 'null'.

All of these produce the same result (groups/null):

groups/{{groupName || ''}
groups/{{groupName ?? ''}
groups/{{!groupName ? '' : groupName}
groups/{{groupName === null ? '' : groupName}
groups/{{typeof groupName === 'null' ? '' : groupName}

Hey @DaveMeehan! You might actually need to use groups/{{typeof groupName === 'undefined' ? '' : groupName}}.

What happens is that, if the query is called without using additionalScope then the expression inside {{}} will throw a ReferenceError (which is why the linter complains). Whenever a transformer errors it returns null by default, so what you're seeing is that each of those expressions is throwing the same error when trying to evaluate groupName. Using typeof to check whether or not a variable has been defined is a workaround for that, you can read more about here, but it requires that you check that the type is undefined instead of null :sweat_smile: