Skip to content

Endpoint URL could not be found in the catalog for this service #91

Open

Description

@tflament

Hello,

I have a problem with that authentification code:

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope'   => ['project' => ['id' => '{projectId}']]
]);

I change all these settings to my configuration.

Return to me that errror : When authenticating with a username, you must also provide either the domain name or domain ID to which the user belongs to. Alternatively, if you provide a user ID instead, you do not need to provide domain information.

So i changed to that one code adding domain information at the user array :

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'domain'    => ['id' => 'default'],
        'password' => '{password}'
    ],
    'scope'   => ['project' => ['id' => '{projectId}']]
]);

But i got that error now : Endpoint URL could not be found in the catalog for this service. Name: swift Type: object-store Region: GRA1 URL type: public

The old API worked well with username password and tenantID. What can i do ?
Thanks in advance.

Activity

  1. haroldiedema commented on Sep 30, 2016

    @haroldiedema

    The v3 API requires you to also specify a domain_id. By default the value for this is "default".

    You can see this in detail on the API reference page at http://developer.openstack.org/api-ref/identity/v3/?expanded=password-authentication-with-unscoped-authorization-detail

  2. kristiandrucker commented on Dec 13, 2016

    @kristiandrucker

    Hi, when using this code to connect to openstack I get the same error

    $this->openstack = new \OpenStack\OpenStack([
                'authUrl' => config('openstack.authUrl'),
                'region'  => config('openstack.region'),
                'user'    => [
                    'id'       => config('openstack.user.id'),
                    'domain'    => [
                        'id' => 'default',
                        'name' => 'Default'
                    ],
                    'password' => config('openstack.user.password')
                ],
                'scope' => [
                    'project' => [
                        'id' => config('openstack.project.id')
                    ]
                ]
            ]);
    Endpoint URL could not be found in the catalog for this service.
    Name: glance
    Type: image
    Region: nova
    URL type: public
    

    please may you fix the issue?

  3. tflament commented on Dec 13, 2016

    @tflament
    Author

    I wasn't able to resolve this bug without using CURL directly to send request to the OpenStack API. I wonder if this problem comes from this library or from the hosting provider. What's your hosting provider ?

  4. kristiandrucker commented on Dec 14, 2016

    @kristiandrucker

    I'm using openstack kolla on my own server.

  5. kristiandrucker commented on Dec 14, 2016

    @kristiandrucker

    It's definitely the library, because I've tried out deis v1 auto provision on openstack from the same laptop to the same server and it worked without any problems.

  6. NexPB commented on Feb 6, 2017

    @NexPB

    I'm having the same issue using OVHs cloud storage.

    Can anyone help me out?

  7. tflament commented on Feb 6, 2017

    @tflament
    Author

    You can use php Curl to exchange with the Object Storage. That's what i'm using for GooPics (hosting images website). This could also help you to directly ask OVH why it's not working with these SDK.

  8. NexPB commented on Feb 6, 2017

    @NexPB

    @adraqi it worked fine with https://github.com/rackspace/php-opencloud but wanted to upgrade to this one.

  9. haphan commented on Feb 7, 2017

    @haphan
    Collaborator

    Hi @nextpb, Thanks for reporting this issue. What is the openstack version in use and can you provide the response from the api?

    I will take a look sometime today.

  10. NexPB commented on Feb 7, 2017

    @NexPB

    @haphan https://www.openstack.org/marketplace/public-clouds/ovh-group/ovh-public-cloud

    What API response would you like? Authenticating using Identity v3 was working fine, but I encoutered this error trying to use object storage.

  11. haphan commented on Feb 7, 2017

    @haphan
    Collaborator

    @NexPB I've not tested the SDK with OVH flavor openstack but my take is it should work.

    You can enable debug by setting debugLog to true and also injecting logger and messageFormatter.

    use GuzzleHttp\MessageFormatter;
    use Monolog\Logger;
    
    $logger = new Logger('console');
    $messageFormatter = new MessageFormatter(MessageFormatter::DEBUG);
    
    $params = [
        'authUrl' => '{authUrl}',
        'region'  => '{region}',
        'user'    => [
            'id'       => '{userId}',
            'domain'    => ['id' => 'default'],
            'password' => '{password}'
        ],
        'scope'   => ['project' => ['id' => '{projectId}']],
    
        // enable debug mode
        'debugLog'         => true,
        'logger'           => $logger,
        'messageFormatter' => $messageFormatter,
    ];
    $openstack = new OpenStack\OpenStack($params);
    
    //Put your problematic code here
    $openstack->objectStoreV1()-> ... 

    This will basically log all the guzzle request and response to console. Please submit the log here so I can take a look.

  12. NexPB commented on Feb 7, 2017

    @NexPB

    @haphan I couldn't get the logging working passing the laravel monolog instance.

    I can provide only the laravel log but I'm not sure if that will be of any help...

    [2017-02-07 18:03:49] local.ERROR: RuntimeException: Endpoint URL could not be found in the catalog for this service.
    Name: swift
    Type: object-store
    Region: SBG1
    URL type: public in /home/vagrant/Code/masterani-2/vendor/php-opencloud/openstack/src/Identity/v3/Models/Catalog.php:46
    Stack trace:
    #0 /home/vagrant/Code/masterani-2/vendor/php-opencloud/openstack/src/Identity/v3/Service.php(41): OpenStack\Identity\v3\Models\Catalog->getServiceUrl('swift', 'object-store', 'SBG1', 'public')
    #1 /home/vagrant/Code/masterani-2/vendor/php-opencloud/openstack/src/Common/Service/Builder.php(96): OpenStack\Identity\v3\Service->authenticate(Array)
    #2 /home/vagrant/Code/masterani-2/vendor/php-opencloud/openstack/src/Common/Service/Builder.php(82): OpenStack\Common\Service\Builder->stockHttpClient(Array, 'ObjectStore\\v1')
    #3 /home/vagrant/Code/masterani-2/vendor/php-opencloud/openstack/src/OpenStack.php(157): OpenStack\Common\Service\Builder->createService('ObjectStore\\v1', Array)
    #4 /home/vagrant/Code/masterani-2/app/Ovh/StorageClient.php(27): OpenStack\OpenStack->objectStoreV1()
    #5 /home/vagrant/Code/masterani-2/app/Providers/OVHServiceProvider.php(31): App\OVH\StorageClient->__construct(Array, 'SBG1', 'official')
    

    EDIT: It seems to work perfectly fine if I authenticate using Identity v2

  13. haphan commented on Feb 20, 2017

    @haphan
    Collaborator

    @NexPBare I am unable to re-produce your issue locally. Perhaps you can double check if the region is indeed SBG1. Please note that SDK consider case-sensitivity so that SBG1 does not match sbg1.

    Alternatively, I have just created this bug report template which hopefully benefit everyone in reporting issue: https://github.com/haphan/openstack-issue-report

    Please follow instruction and post the result here. Thank you.

  14. haphan commented on Feb 20, 2017

    @haphan
    Collaborator

    @adraqi @kristiandrucker Can you also follow following issue report template https://github.com/haphan/openstack-issue-report and post result here? Thank you.

  15. julienfastre commented on Jul 25, 2017

    @julienfastre

    Hi,

    I experienced the same issue as @NexPB, and I could reproduce the bug using the api directly with curl: the catalog is empty when you retrieve a token without tenant information.

    Using those params solve the problem :

    $params = [
                'username' => $username,
                'password' => $password,
                'authUrl'  => $auth_url,
                'region'   => $region,
                // the tenant id is required here for a valid catalog
                'tenantId' => $tenant_id,
                // this result in an empty service catalog
                /*
                'scope' => [
                    'project' => [
                        'id' => $tenant_id,
                    ]
                ],
                 */
                'identityService'   => \OpenStack\Identity\v2\Service::factory(
                    new \GuzzleHttp\Client( [
                        'base_uri'  => \OpenStack\Common\Transport\Utils::normalizeUrl( $auth_url ),
                        'handler'   => \GuzzleHttp\HandlerStack::create(),
                    ] ) ),
            ]
    ;

    HTH

  16. thiagodamas commented on Sep 18, 2017

    @thiagodamas

    Hi,
    after investigating, I solved the problem with the following code:

    diff -ru vendor/php-opencloud/openstack/src/Identity/v3/Models/Endpoint.php ../openstack/vendor/php-opencloud/openstack/src/Identity/v3/Models/Endpoint.php
    --- vendor/php-opencloud/openstack/src/Identity/v3/Models/Endpoint.php	2017-07-14 04:39:28.000000000 -0300
    +++ ../openstack/vendor/php-opencloud/openstack/src/Identity/v3/Models/Endpoint.php	2017-09-18 16:37:45.303314819 -0300
    @@ -77,6 +77,8 @@
     
         public function regionMatches(string $value): bool
         {
    +        if($this->region == '*')
    +            return true;
             return $this->region && $this->region == $value;
         }
     
    diff -ru vendor/php-opencloud/openstack/src/Identity/v3/Models/Service.php ../openstack/vendor/php-opencloud/openstack/src/Identity/v3/Models/Service.php
    --- vendor/php-opencloud/openstack/src/Identity/v3/Models/Service.php	2017-07-14 04:39:28.000000000 -0300
    +++ ../openstack/vendor/php-opencloud/openstack/src/Identity/v3/Models/Service.php	2017-09-18 16:31:53.184373496 -0300
    @@ -79,7 +79,7 @@
     
         private function typeMatches(string $value): bool
         {
    -        return $this->type && $this->type = $value;
    +        return $this->type && $this->type == $value;
         }
     
         /**
    @@ -94,7 +94,7 @@
          */
         public function getUrl(string $name, string $type, string $region, string $interface)
         {
    -        if (!$this->nameMatches($name) || !$this->typeMatches($type)) {
    +        if (!$this->nameMatches($name) && !$this->typeMatches($type)) {
                 return false;
             }
  17. phansys commented on Feb 2, 2018

    @phansys

    Fix proposed at #154. BTW, this issue seems to be vendor specific (Telefónica Open Cloud).

  18. cocosistemas commented on Feb 9, 2018

    @cocosistemas

    I have the same problem. After debugging, in vendor/php-opencloud/openstack/src/Identity/v3/Models/Service.php; in method getUrl (it is previous to throw the 'EndPoint Url not found...', the values are:

    this.name: EMPTY
    this.type: object-store
    name: swift
    type: object-store

    so, this.name !== name, getUrl returns false and never find endpoint so throws the exception.

    Then, ¿why $this->name is empty? anyone knows how to solve this? (if it wash 'swift' the endpoint would be found.

    the code:

    public function getUrl(string $name, string $type, string $region, string $interface)
    {
    //this is my poor man debug method:
    echo 'this.name '.$this->name.' this.type '.$this->type.' name '.$name.' type '.$type.'
    ';
    if (!$this->nameMatches($name) || !$this->typeMatches($type)) {
    return false;
    }

    Thansk!

  19. Frzk commented on Jun 24, 2019

    @Frzk

    I pulled my hair upon this one today and finally figured it out after a few hours.

    In my case I needed to pass the catalogName option when creating the object store object, so that it will match the provider's one instead of the default swift.

    $objectStoreOptions = [
        'catalogName' => 'openio-swift',
    ];
    
    $openstack = new OpenStack\OpenStack($yourParams);
    $objectStore = $openstack->objectStoreV1($objectStoreOptions);

    Another available option is catalogType, which defaults to object-store.

    I've been able to figure out the value by reading the token value.

    Hope it can help :-)

  20. tomasruprich commented on Apr 15, 2020

    @tomasruprich

    Hi guys, just needed to solve the very same error.
    I personally use OVH services on multiple projects and price for their products is unbeatable. Huge problem with OVH is in the complete lack of documentation and support with anything behind scope of basic usage.

    Which is probably cause of many issues posted in this thread. All OVH cloud services are connected with datacenter (SBG3, GRA1 etc.), just object storage is connected with region (SBG, GRA) and not the specific datacenter.
    You need to go to the Openstack Horizon management interface and check API access. If you choose datacenter SBG3 or GRA3, then you'll see just a dash in the EndPoint column. You have to switch to SBG/GRA/whatever and there you have object storage endpoint (and all other endpoints are missing).

    So the issue doesn't seem to be connected with PHP OpenStack SDK, EndPoint really isn't defined with datacenters specified in former posts.

    This code based on former solutions is OVH compatible:

    </php
    require 'vendor/autoload.php';
    
    $username = 'ovh-horizon-username';
    $password = 'ovh-horizon-password';
    $region = 'SBG';
    $container = 'test-container';
    // projectName/projectId are visible on https://horizon.cloud.ovh.net/identity/
    $projectName = '0123456789012345';
    $projectId = '0987654321abcdef0987654321abcdef';
    
    $openstack = new \OpenStack\OpenStack([
      'authUrl' => 'https://auth.cloud.ovh.net/v3/',
      'region' => $region,
      'user'    => [
          'name'       => $username,
          'domain'    => ['id' => 'default'],
          'password' => $password
      ],
      'scope'   => [
        'project' => [
          'id' => $projectId,
          'name' => $projectName,
          'domain' => ['id' => 'default', 'name' => 'Default'],
        ]
      ],
    ]);
    
    $service = $openstack->objectStoreV1();
    $container = $service->getContainer($container);
    ...
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions