The script attempts to fetch API version information with HTTP on port 80. If TrueNAS listens to another HTTP port, this fails and the legacy client is used instead of the JSON RPC client.
The attach patch adds a configuration key, connect_port_http, to allow the port to be overridden.
Configurable_HTTP_port_for_version_information.patch