Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid requestUri on GeoPlacesClient > getPlace #3030

Closed
1 task
SiMoSiMo2 opened this issue Nov 18, 2024 · 5 comments
Closed
1 task

Invalid requestUri on GeoPlacesClient > getPlace #3030

SiMoSiMo2 opened this issue Nov 18, 2024 · 5 comments
Labels
bug This issue is a bug. p2 This is a standard priority issue queued This issues is on the AWS team's backlog

Comments

@SiMoSiMo2
Copy link

Describe the bug

I am trying to use Amazon Location Service Places V2 but following the documentation (https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-geo-places-2020-11-19.html) I cannot get the GetPlace call to work.

I successfully instantiate the GeoPlacesClient client and then call GetPlace passing Language and PlaceId parameters (I also tried adding the Key parameter).

However, the call throws an GeoPlacesException exception:

AccessDeniedException (client): Unable to determine service/operation name to be authorized - {"Message":"Unable to determine service/operation name to be authorized"}

Parsing the requested URL it seems that v2 is missing from the URI
client request: https://places.geo.eu-central-1.amazonaws.com/place/AQAAADg...
working request: https://places.geo.eu-central-1.amazonaws.com/v2/place/AQAAADg...

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

I expect to get Result object.

Current Behavior

I have this exception:

AccessDeniedException (client): Unable to determine service/operation name to be authorized - {"Message":"Unable to determine service/operation name to be authorized"}

Reproduction Steps

Instantiate the client (https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.GeoPlaces.GeoPlacesClient.html):

$client = new GeoPlacesClient([
    'credentials' => $credentials,
    'region'      => $region,
    'version'     => 'latest',
]);

call the method (https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-geo-places-2020-11-19.html#getplace):

$result = $awsClient->getPlace([
    'PlaceId'  => $placeId,
    'Key'      => $key,
]);

Possible Solution

No response

Additional Information/Context

I've tried to add v2 to the requestUri inside vendor/aws/aws-sdk-php/src/data/geo-places/2020-11-19/api-2.json.php and I've got the expected response

SDK version used

3.328.0

Environment details (Version of PHP (php -v)? OS name and version, etc.)

PHP 8.3.6

@SiMoSiMo2 SiMoSiMo2 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 18, 2024
@yenfryherrerafeliz
Copy link
Contributor

Hey @SiMoSiMo2, sorry to hear about your issues. We are currently working on a fix for this. In the meantime, would you please use the following workaround:

$client = new GeoPlacesClient([
    'region' => 'us-east-2',
]);
$client->getHandlerList()->appendBuild(
    \Aws\Middleware::mapRequest(function (RequestInterface $request) {
        $uri = $request->getUri();
        $uri = $uri->withPath(
            '/v2' . $uri->getPath()
        );

        return $request->withUri($uri);
    })
);
... ANY REQUEST with the client created previously

I know you mentioned you were able to get it working by editing the model file geo-places/2020-11-19/api-2.json.php but it will get overriding anytime you update your SDK dependency.

Please let me know if that helps!

Thanks!

@yenfryherrerafeliz yenfryherrerafeliz added p2 This is a standard priority issue queued This issues is on the AWS team's backlog and removed needs-triage This issue or PR still needs to be triaged. labels Nov 18, 2024
@SiMoSiMo2
Copy link
Author

Hi @yenfryherrerafeliz thanks for your workaround. It works!

@stobrien89
Copy link
Member

Hi @SiMoSiMo2,

Thanks for your patience. This should be fixed as of today's release. Could you let us know if this is resolved after upgrading? Thanks!

@stobrien89 stobrien89 added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 21, 2024
@SiMoSiMo2
Copy link
Author

Hi @stobrien89 it seems that everything works fine.
Thank you so much for the support

@yenfryherrerafeliz yenfryherrerafeliz removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 22, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue queued This issues is on the AWS team's backlog
Projects
None yet
Development

No branches or pull requests

3 participants