Studio Snippet INVALID_FUNCTION error with GetRESTProxy

I’m hitting a wall with a script update. We are trying to call an internal microservice to fetch user preferences before the agent transfer. The endpoint is secure, so we are using the GetRESTProxy action.

The script fails immediately at the node with an INVALID_FUNCTION error. The debug log just says “Function execution failed” without much detail. I’ve checked the API docs and the syntax looks correct, but something is off.

Here is the exact code block in the node:

proxy = GetRESTProxy("https://internal-api.myco.com/v1/prefs", "GET")

headers = {}
headers["Authorization"] = "Bearer " + $auth_token
headers["Content-Type"] = "application/json"

proxy.setHeaders(headers)
proxy.setQueryParam("userId", $contact.id)

response = proxy.execute()

The error happens on the first line. I suspect it might be how I’m passing the URL or maybe the function isn’t available in the current runtime version of our instance. We are on the latest patch.

I tried wrapping the URL in quotes like "https://..." which I have done. I also tried passing the method as a separate argument like GetRESTProxy("url", "GET") which is also what I have done.

Is there a specific format for the URL? Do I need to encode it? I read somewhere that special characters in the URL can break the function, but this is a clean path.

Also, the $auth_token variable is populated correctly from a previous REST action. I verified it in the debug window. It’s a valid JWT string.

I’ve restarted the script multiple times. I even tried creating a new node from scratch. Same error.

Any idea what triggers INVALID_FUNCTION for GetRESTProxy? Is it a permissions issue on the proxy config? Or is the syntax wrong? I’m stuck.