ckfinder / ckfinder-laravel-package

CKFinder 3 package for Laravel
Other
153 stars 86 forks source link

"Unknown error." with S3 adapter #60

Open Askancy opened 3 years ago

Askancy commented 3 years ago

im trying to configure my ckfinder with my DigitalOcean Spaces/ S3 space, but i get the error:

"Unknown error."

when I try to open the ckfinder.

this is the configuration:

$config['backends']['default'] = array(
    'name'         => 'default',
    'adapter'      => 's3',
    'bucket'       => 'projectx',
    'region'       => 'ams3',
    'key'          => '****',
    'secret'       => '*****',
    'visibility'   => 'public',
    'baseUrl'      => 'https://ams3.digitaloceanspaces.com/projectx/',
  function selectFileWithCKFinder( elementId ) {
    CKFinder.modal( {
      chooseFiles: true,
      width: 800,
      height: 600,
      rememberLastFolder: false,
      startupPath: "kk/gallery:"+ values,
      skin: 'jquery-mobile',

      onInit: function( finder ) {
        finder.on( 'files:choose', function( evt ) {
          var file = evt.data.files.first();
          var output = document.getElementById( elementId );
          output.value = file.getUrl();
        } );
        finder.on( 'file:choose:resizedImage', function( evt ) {
          var output = document.getElementById( elementId );
          output.value = evt.data.resizedUrl;
        } );
      }
    } );
  }

the pictures are respectively in: https://ams3.digitaloceanspaces.com/projectx/kk/gallery/id(value selected)

how come I can't view any images? any ideas? bucket access data is correct and tested.

Askancy commented 3 years ago

Doing further research:

VM1292:1 GET https://project.it/ckfinder/connector?command=GetFiles&lang=it&type=Gallery&currentFolder=%2F1%2F&hash=2a12bd16454bdc38 500

log error:

cURL error 6: Could not resolve host: projectnet.s3.ams3.amazonaws.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) {"url":"https://project.it/ckfinder/connector","precedente":"https://project.it/admin/articoli/add","input":{"command":"GetFolders","lang":"it","type":"Gallery","currentFolder":"/","hash":"2a12bd16454bdc38"}}

Error executing "PutObject" on "https://projectnet.s3.ams3.amazonaws.com/gallery/"; AWS HTTP error: cURL error 6: Could not resolve host: projectnet.s3.ams3.amazonaws.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) {"userId":2,"exception":"[object] (Aws\\S3\\Exception\\S3Exception(code: 0): Error executing \"PutObject\" on \"https://projectnet.s3.ams3.amazonaws.com/gallery/\"; AWS HTTP error: cURL error 6: Could not resolve host: projectnet.s3.ams3.amazonaws.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) at /var/www/vhosts/project.it/httpdocs/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php:195)

how come it sets as amazonaws endpoint and not digitaloceanspaces, as set by filesystem config and ckfinder config?

I found this as well: https://github.com/ckfinder/ckfinder/issues/340

but I don't quite understand what to do, i put IF control as said by the user in

\vendor\ckfinder\ckfinder-laravel-package_connector\Backend\BackendFactory.php

to line 206, without solving the problem...

bmlotek commented 1 year ago

Hello, do you still have the problem?

Askancy commented 1 year ago

Hi bmlotek,

Given the poor support I have dropped ckfinder, preferring alexusmai/laravel-file-manager, if you can guarantee me that the package will not be dropped again I will come back...

Anyway I solved it with:

$config['backends']['default'] = array(
    'name'         => 'awss3',
    'adapter'      => 's3',
    'bucket'       => '***',
    'region'       => 'fra1',
    'endpoint'     => 'https://fra1.digitaloceanspaces.com',
    'key'          => '***',
    'secret'       => '****',
    'visibility'   => 'public',
    'root'         => '***'
);
        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
            'endpoint' => env('AWS_ENDPOINT'),
            'visibility' => 'public-read',
        ]

I hope this will help someone.