vaersaagod / dospaces

DigitalOcean Spaces integration for Craft CMS
MIT License
35 stars 8 forks source link

Upload failed. The error message was: “Endpoints must be full URIs and include a scheme and host” #4

Closed toddpadwick closed 5 years ago

toddpadwick commented 5 years ago

Trying to set up spaces but I can't seem to get it to work. I have the following .env variables set up:

SPACES_API_KEY="XXXXXXXXXXXXXXX"

SPACES_SECRET="XXXXXXXXXXXXXXX"

SPACES_ENDPOINT="https://sfo2.digitaloceanspaces.com"

SPACES_REGION="sfo2"

SPACES_BUCKET="test"

SPACES_URL="https://test.sfo2.digitaloceanspaces.com"

I then have the following alias' setup:

'aliases' => [

            '@spacesUrl' => getenv('SPACES_URL'),

            '@spacesKey' => getenv('SPACES_API_KEY'),

            '@spacesSecret' => getenv('SPACES_SECRET'),

            '@spacesEndpoint' => getenv('SPACES_ENDPOINT'),

            '@spacesRegion' => getenv('SPACES_REGION'),

            '@spacesBucket' => getenv('SPACES_BUCKET'),

        ],

and finally here is a screenshot of my volume set up:

image

Im new to using a CDN for assets so I've probably made an obvious mistake but any help would be really appreciated :)

benjaminleonard commented 5 years ago

I had the same error – until I added this (with the correct handle) to volumes.php Not sure why it has to be duplicated across the asset fields, and volumes.php – or which value it prioritises.

return [ 'mySpacesVolumeHandle' => [ 'hasUrls' => true, 'url' => 'https://my-spaces-bucket.ams3.digitaloceanspaces.com/', 'keyId' => getenv('SPACES_API_KEY'), 'secret' => getenv('SPACES_SECRET'), 'endpoint' => getenv('SPACES_ENDPOINT'), 'region' => getenv('SPACES_REGION'), 'bucket' => getenv('SPACES_BUCKET'), ], ];

Tam commented 5 years ago

@toddpadwick @benjaminleonard I've added support for aliases and env variables in #5, hopefully it'll be merged soon!

aelvan commented 5 years ago

The original error was due to the volume driver not parsing aliases. This has been added in v1.1.0, thanks to @Tam.

toddpadwick commented 5 years ago

Ah I see... excellent, thanks @Tam and @aelvan :)