Powershell get-tag command fails to get data from vCenter
search cancel

Powershell get-tag command fails to get data from vCenter

book

Article ID: 413801

calendar_today

Updated On:

Products

VMware vCenter Server 8.0

Issue/Introduction

  • After connecting to the vCenter in powershell and running a get-tag command, the following error is prompted.

  • Get-Tag: mm/dd/yyyy hh:mm:ss pm    Get-Tag     com.vmware.vapi.std.errors.internal_server_error {'messages': [com.vmware.vapi.std.localized_message {'id': com.vmware.vapi.endpoint.badGateway, 'default_message': The endpoint, while acting as a gateway, received an invalid response from an upstream server it accessed while attemtping to fulfill the request., 'args': {}, 'params': , 'localized':}}, 'data': , 'error_type': INTERNAL_SERVER_ERROR}

Environment

vCenter 8.x

Powershell version 7.5.3

Cause

Depending on the amount of data collection and latency on the network, retrieving the data may take longer than the default vapi session timeout (10seconds).

Resolution

As a workaround, increase the vapi session timeout value by adding the property:

  1. Login to the VCSA commandline interface with root user
  2. Backup the endpoint.properties file: cp /etc/vmware-vapi/endpoint.properties /root/endpoint.properties.bck
  3. Change the property in the vapi-endpoint properties file: echo "session.child.soTimeout=20000" >> /etc/vmware-vapi/endpoint.properties
  4. Restart the service in order for the change to take effect: service-control --restart vapi-endpoint