Aws-sdk-php: ApiGatewayV2Client->getApi returns Aws\Api\Service

Created on 20 Dec 2019  路  4Comments  路  Source: aws/aws-sdk-php

Please fill out the sections below to help us address your issue.

Version of AWS SDK for PHP?

3.130.0

Version of PHP (php -v)?

7.3.9

What issue did you see?

I'm trying to use the new ApiGatewayV2Client, creating an API using createApi works fine and returns a Aws\Result object. But if I try to fetch the API again using getApi, I get a Aws\Api\Service object instead. Here's the code sample used to reproduce the issue:

$client = new ApiGatewayV2Client([
    'region' => 'us-east-1',
    'version' => '2018-11-29',
]);

$api = $client->createApi([
    'Name' => 'test-api',
    'ProtocolType' => 'HTTP',
]);

$result = $client->getApi([
    'ApiId' => $api->get('ApiId'),
]);

var_dump(get_class($result));

This code returns 锘匡豢string(15) "Aws\Api\Service"

bug

All 4 comments

Thanks for bringing this to our attention @carlalexander and I do apologize for the delay in response on this. I'm able to reproduce this behavior on my end with both ApiGatewayClient and ApiGatewayV2Client, looking at the output it seems like this method is dumping the contents of src/data/manifest.json as well as the service's API model.

This function looks to work as expected on other AWS SDKs, since this behavior appears to be exclusive to the AWS SDK for PHP I'm marking this issue as a bug. Once we have additional information on this we'll update the issue accordingly.

No worries @diehlaws. It's the holidays. I figure things are slowed down! 馃槂

@howardlopez has a PR up for this in https://github.com/aws/aws-sdk-php/pull/1944

@carlalexander #1944 has been merged and will go out in the next release. The actual service API operation GetApi is now aliased to GetApiResource, as GetApi is used by our core AwsClient.

Was this page helpful?
0 / 5 - 0 ratings