Php quicksight sdk broken after running a composer update

I am working with amazon quicksight to do embedding reporting on my website, and we recently made an update to newer version of the php developer kit, and after this update we can no longer create new IAM users in our embedded reporting tools. The only thing that changes was the version of the SDK, and we are getting the error

Uncaught Error: Call to undefined method TypeError::getAwsErrorCode()

I looked into this PHP fatal error, which is resulting from the Promise Handler (Promise.php from the SDK vendor) returning an Error type instead of an Exception type, so it’s not anything to do wiht our code. I am hoping to resolve this issue since we are migrating to QuickSight for reporting tools and it was working up until this update occurred. TYIA for the help

Here is the function which is throwing the uncaught exception from our quicksight plugin.

public function listUserGroups($username) {

  $log = new Log("Quicksight");

  $log->debug("Inside listUserGroups");
  //$log->debug("Included Files: ", get_included_files());
  $log->debug("username $username");

  $promises=[];	
  $groups = [];
  $nextToken=NULL;
  do {
  	$promises['UserGroups']=$this->qsClient->listUserGroupsAsync([
  		'AwsAccountId' => $this->AwsAccountId,
  		'MaxResults' => 100,
  		'Namespace' => 'default',
  		'NextToken' => $nextToken,
  		'UserName' => $this->embedRole . '/' . $username
  	])->then(function($results) {
  		return $results->toArray();
  	})
  	->otherwise(function ($reason) {
  		$log = new Log("Quicksight");
  		$log->debug("ERROR THROWN");
  		$log->debug(print_r($reason,true));
  		$code=$reason->getAwsErrorCode();
  		$log->debug("NEED TO BE HERE");
  		return $code;
  	});

  	$result = Utils::unwrap($promises);


  	if ($result['UserGroups'] == 'ResourceNotFoundException')
  		return 'ResourceNotFoundException';

  	$log->debug("FINISHED");

  	$curGroups = array_column($result['UserGroups']['GroupList'],'GroupName');
  	if (isset($result['UserGroups']['NextToken']))
  		$nextToken = $result['UserGroups']['NextToken'];
  	else 
  		$nextToken = null;
  	$groups=array_merge($groups, $curGroups);
  } 
  while ($nextToken != NULL);

  return $groups;

}

1 Like

Hi @dclutes3,
Apologies from the QuickSight community that this message went unanswered. When a second response gets added, the topic gets removed from the new and unanswered list so could end up being missed by the team. I would suggest for any potential future posts, instead of adding a second comment, you can edit your original post instead!

In regards to your question, are you still encountering the same error or were you able to find a work around?

Hi @dclutes3,
Since we haven’t heard back, I’ll close out this topic. However, if you have any additional questions, feel free to create a new post in the community and link this discussion for relevant information if needed.

Thank you!