sausin / laravel-ovh

Wrapper for OVH Object Storage integration with laravel
MIT License
37 stars 12 forks source link

[OVH | keystone v3] Endpoint URL could not be found in the catalog for this service. #69

Closed renepardon closed 4 years ago

renepardon commented 4 years ago

Hello, I tried to stick as much as possible to the documentation but can't get this lib working with OVH and keystone v3.

This is my environment:

FILESYSTEM_DRIVER="openstack" OS_AUTH_URL="https://auth.cloud.ovh.net/v3" OS_PROJECT_ID="x...k" OS_REGION_NAME="UK1" OS_USER_DOMAIN_NAME="Default" OS_USERNAME="P...D" OS_PASSWORD="e...s" OS_CONTAINER_NAME="" OS_CACHE="false"

filesystems.php

        'openstack' => [
            'driver'        => 'ovh',
            'authUrl'       => env('OS_AUTH_URL', 'https://auth.cloud.ovh.net/v3/'),
            'projectId'     => env('OS_PROJECT_ID'),
            'region'        => env('OS_REGION_NAME', ''),
            'userDomain'    => env('OS_USER_DOMAIN_NAME', 'Default'),
            'username'      => env('OS_USERNAME', ''),
            'password'      => env('OS_PASSWORD', ''),
            'containerName' => env('OS_CONTAINER_NAME', ''),
            'tempUrlKey'    => env('OS_TEMP_URL_KEY'),
            'endpoint'      => env('OS_CUSTOM_ENDPOINT'),
            'swiftLargeObjectThreshold' => env('OS_LARGE_OBJECT_THRESHOLD', 300 * 1024 * 1024),
            'swiftSegmentSize' => env('OS_SEGMENT_SIZE', 100 * 1024 * 1024),
            'swiftSegmentContainer' => env('OS_SEGMENT_CONTAINER', null),
            'cache' => env('OS_CACHE', false), // Defaults to false
            'prefix' => null,
        ],

And this the stacktrace:

[2020-06-30 13:07:14] local.INFO: ffprobe executed command successfully
[2020-06-30 13:07:17] local.ERROR: Endpoint URL could not be found in the catalog for this service.
Name: swift
Type: object-store
Region: UK1
URL type: public {"userId":2,"exception":"[object] (RuntimeException(code: 0): Endpoint URL could not be found in the catalog for this service.
Name: swift
Type: object-store
Region: UK1
URL type: public at /Users/renepardon/Projects/whatever/vendor/php-opencloud/openstack/src/Identity/v3/Models/Catalog.php:59)
[stacktrace]
#0 /Users/renepardon/Projects/whatever/vendor/php-opencloud/openstack/src/Identity/v3/Service.php(50): OpenStack\\Identity\\v3\\Models\\Catalog->getServiceUrl('swift', 'object-store', 'UK1', 'public')

My used versions are:

Error happens when I try to upload a freshly transcoded video file through FFMpeg extension:

'uploads' is of type 'local' filesystem and filesystems.default points to the 'openstack' disk.

        FFMpeg::fromDisk('uploads')
            ->open($file->getName())
            ->addFilter(function ($filters) {
                $filters->resize(new Dimension(960, 540));
            })
            ->export()
            ->toDisk(config('filesystems.default'))
            ->inFormat($lowBitrateFormat)
            ->save(sprintf('/videos/download/%d/%d/%s.mp4', $tenant->id, $user->id, $name));
sausin commented 4 years ago

@renepardon

Could you remove the below entries from your filesystems config file:

            'tempUrlKey'    => env('OS_TEMP_URL_KEY'),
            'endpoint'      => env('OS_CUSTOM_ENDPOINT'),
            'swiftLargeObjectThreshold' => env('OS_LARGE_OBJECT_THRESHOLD', 300 * 1024 * 1024),
            'swiftSegmentSize' => env('OS_SEGMENT_SIZE', 100 * 1024 * 1024),
            'swiftSegmentContainer' => env('OS_SEGMENT_CONTAINER', null),
            'cache' => env('OS_CACHE', false), // Defaults to false
            'prefix' => null,

and try again?

EDIT:- If you're using caching on the config file, be sure to run:

php artisan config:cache

again after making the changes.

EDIT2:- Also, I'm assuming you've got the OS_CONTAINER_NAME specified in the .env file and just shown empty above for demonstration purposes.

iksaku commented 4 years ago

Also, remember to migrate your region from UK1 to UK.

renepardon commented 4 years ago

Hi @sausin

for your edit 2: no, I use the environment just as displayed in my first posting (.env) for your edit 1: also as defined, cache is set to false for your initial answer: Also by removing those information from filesystems.php - no change ;(

@iksaku

I tried this, then I receive another error. Same when I set "GRA" (which is our main region) but UK1 is defined in the OpenStack RC config file. So that's why I stuck with this. The new error (when using "GRA" or "UK") is:

[2020-07-01 05:29:17] local.INFO: ffprobe executed command successfully
[2020-07-01 05:29:19] local.ERROR: HTTP Error
~~~~~~~~~~
The remote server returned a "400 Bad Request" error for the following transaction:

Request
~~~~~~~
HEAD /videos/download/1/2/video-18c30e81-ff53-45e1-9569-5a96ee9692c0.mp4 HTTP/1.1
User-Agent: GuzzleHttp/6.5.5 curl/7.70.0 PHP/7.4.6
Host: storage.uk.cloud.ovh.net

Response
~~~~~~~~
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=UTF-8
Content-Length: 0
X-Trans-Id: tx0e32ab<...>efc1f2e
X-Openstack-Request-Id: tx0e32ab<...>5efc1f2e
Date: Wed, 01 Jul 2020 05:29:19 GMT

Further information
~~~~~~~~~~~~~~~~~~~
Please ensure that your input values are valid and well-formed. Visit http://docs.php-opencloud.com/en/latest/http-codes for more information about debugging HTTP status codes, or file a support issue on https://github.com/php-opencloud/openstack/issues. {"userId":2,"exception":"[object] (OpenStack\\Common\\Error\\BadResponseError(code: 0): HTTP Error
~~~~~~~~~~
The remote server returned a \"400 Bad Request\" error for the following transaction:

Request
~~~~~~~
HEAD /videos/download/1/2/video-18c30e81-ff53-45e1-9569-5a96ee9692c0.mp4 HTTP/1.1
User-Agent: GuzzleHttp/6.5.5 curl/7.70.0 PHP/7.4.6
Host: storage.uk.cloud.ovh.net

Response
~~~~~~~~
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=UTF-8
Content-Length: 0
X-Trans-Id: tx0e32ab<...>efc1f2e
X-Openstack-Request-Id: tx0e32a<...>1f2e
Date: Wed, 01 Jul 2020 05:29:19 GMT

Further information
~~~~~~~~~~~~~~~~~~~
Please ensure that your input values are valid and well-formed. Visit http://docs.php-opencloud.com/en/latest/http-codes for more information about debugging HTTP status codes, or file a support issue on https://github.com/php-opencloud/openstack/issues. at /Users/renepardon/Projects/whatever/vendor/php-opencloud/openstack/src/Common/Error/Builder.php:128)
[stacktrace]
#0 /Users/renepardon/Projects/whatever/vendor/php-opencloud/openstack/src/Common/Transport/Middleware.php(27): OpenStack\\Common\\Error\\Builder->httpError(Object(GuzzleHttp\\Psr7\\Request), Object(GuzzleHttp\\Psr7\\Response))

I don't really know what the bad request is here. Because with another storage (minio for example) it works perfectly.

sausin commented 4 years ago

Hi @sausin

for your edit 2: no, I use the environment just as displayed in my first posting (.env) for your edit 1: also as defined, cache is set to false for your initial answer: Also by removing those information from filesystems.php - no change ;(

OS_CONTAINER_NAME is required, it cannot be empty. Could you please specify it in the .env file and try again?

renepardon commented 4 years ago

Whatever > Object Storage > storage1

I gave OS_CONTAINER_NAME the value "storage1" as defined in OVH backend and I changed the region to UK instead of UK1. Now it works. Thank you very much :)