Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Image/File Uploading via Directus App #642

Closed
tbhanushali opened this issue Dec 9, 2018 · 8 comments
Closed

Image/File Uploading via Directus App #642

tbhanushali opened this issue Dec 9, 2018 · 8 comments
Labels
bug Something isn't working

Comments

@tbhanushali
Copy link

Bug Report

The uploading files and images feature in the Directus app is not working.

Steps to Reproduce

  1. Go to ' Admin/File Library'
  2. Click on 'Add sign on top corner'
  3. Upload an Image or a file
  4. See error "Trouble processing request. Try again after refreshing the page."

Expected Behavior

To be able to upload an image

Actual Behavior

Error, unable to upload any file or image

Other Context & Screenshots

The progress bar completes and just as it reaches 100% this error shows up. I am unable to upload any files or images to my back-end.

Technical Details

  • Device: [ Laptop]
  • OS: [Windows 10]
  • Browser: [Chrome 70.0.3538.110]
  • Directus App: [eg: 7.0.9]
@rijkvanzanten
Copy link
Member

On what server is this happening? Is there any issue visible in the browser console? If there's an error logged in the /logs folder in the api, what does it say?

@tbhanushali
Copy link
Author

tbhanushali commented Dec 9, 2018

I am hosting this on hosting that I bought online, managing the server through cpanel. Installed directus for a custom domain. This is the error code showing in the console when I try and upload an image.

Client side stack trace
POST http://test1.ezmach.net/_/files 500 (Internal Server Error)
(anonymous) @ xhr.js:178
e.exports @ xhr.js:12

e.exports @ dispatchRequest.js:59
Promise.then (async)
a.request @ Axios.js:51
a.(anonymous function) @ Axios.js:71
(anonymous) @ bind.js:9
uploadFiles @ remote.cjs.js:681
save @ upload.vue:130
filesChange @ upload.vue:109
change @ upload.vue?1411:11
t @ vue.runtime.esm.js:2023
e._withTask.e._withTask @ vue.runtime.esm.js:1822
error.js:9 {…}class: (...)code: (...)file: (...)line: (...)message: (...)ob: Ae {value: {…}, dep: le, vmCount: 0}get class: ƒ ()set class: ƒ (t)get code: ƒ ()set code: ƒ (t)get file: ƒ ()set file: ƒ (t)get line: ƒ ()set line: ƒ (t)get message: ƒ ()set message: ƒ (t)proto: Object
mc @ error.js:9
Dt.e.$emit @ vue.runtime.esm.js:2534
$api.uploadFiles.then.then.catch.e @ upload.vue:147
Promise.catch (async)
save @ upload.vue:145
filesChange @ upload.vue:109
change @ upload.vue?1411:11
t @ vue.runtime.esm.js:2023
e._withTask.e._withTask @ vue.runtime.esm.js:1822
xhr.js:178 POST http://test1.ezmach.net/_/files 500 (Internal Server Error)
(anonymous) @ xhr.js:178
e.exports @ xhr.js:12
e.exports @ dispatchRequest.js:59
Promise.then (async)
a.request @ Axios.js:51
a.(anonymous function) @ Axios.js:71
(anonymous) @ bind.js:9
uploadFiles @ remote.cjs.js:681
save @ upload.vue:130
filesChange @ upload.vue:109
change @ upload.vue?1411:11
t @ vue.runtime.esm.js:2023
e._withTask.e._withTask @ vue.runtime.esm.js:1822
error.js:9 {…}class: (...)code: (...)file: (...)line: (...)message: (...)ob: Ae {value: {…}, dep: le, vmCount: 0}get class: ƒ ()set class: ƒ (t)get code: ƒ ()set code: ƒ (t)get file: ƒ ()set file: ƒ (t)get line: ƒ ()set line: ƒ (t)get message: ƒ ()set message: ƒ (t)proto: Object
mc @ error.js:9
Dt.e.$emit @ vue.runtime.esm.js:2534
$api.uploadFiles.then.then.catch.e @ upload.vue:147
Promise.catch (async)
save @ upload.vue:145
filesChange @ upload.vue:109
change @ upload.vue?1411:11
t @ vue.runtime.esm.js:2023
e._withTask.e._withTask @ vue.runtime.esm.js:1822

@rijkvanzanten
Copy link
Member

How big was the file you were trying to upload? Did it exceed the php max upload size (although that should throw a 400 error)?

Does the php user have write access to the files?

@tbhanushali
Copy link
Author

No it's a pretty small image and yes the php user has write access.

@rijkvanzanten rijkvanzanten transferred this issue from another repository Dec 9, 2018
@rijkvanzanten rijkvanzanten added the bug Something isn't working label Dec 9, 2018
@rijkvanzanten
Copy link
Member

@wellingguzman I'm getting this error on the demo server:

ERROR: TypeError: Argument 1 passed to Directus\Filesystem\FilesystemFactory::createAdapter() must be of the type array, null given, called in /var/www/api/src/core/Directus/A pplication/CoreServicesProvider.php on line 984 and defined in /var/www/api/src/core/Directus/Filesystem/FilesystemFactory.php:14

Full stack trace
[2018-12-09 18:03:36] api[_].ERROR: TypeError: Argument 1 passed to Directus\Filesystem\FilesystemFactory::createAdapter() must be of the type array, null given, called in /var/www/api/src/core/Directus/A
pplication/CoreServicesProvider.php on line 984 and defined in /var/www/api/src/core/Directus/Filesystem/FilesystemFactory.php:14                                                                          
Stack trace:                                                                                                                                                                                               
#0 /var/www/api/src/core/Directus/Application/CoreServicesProvider.php(984): Directus\Filesystem\FilesystemFactory::createAdapter(NULL, 'root')                                                            
#1 /var/www/api/vendor/pimple/pimple/src/Pimple/Container.php(118): Directus\Application\CoreServicesProvider->Directus\Application\{closure}(Object(Directus\Application\Container))                      
#2 /var/www/api/src/core/Directus/Container/Container.php(27): Pimple\Container->offsetGet('filesystem')                                                                                                   
#3 /var/www/api/src/core/Directus/Application/CoreServicesProvider.php(1113): Directus\Container\Container->get('filesystem')                                                                              
#4 /var/www/api/vendor/pimple/pimple/src/Pimple/Container.php(118): Directus\Application\CoreServicesProvider->Directus\Application\{closure}(Object(Directus\Application\Container))                      
#5 /var/www/api/src/core/Directus/Container/Container.php(27): Pimple\Container->offsetGet('files')                                                                                                        
#6 /var/www/api/src/core/Directus/Application/CoreServicesProvider.php(283): Directus\Container\Container->get('files')                                                                                    
#7 /var/www/api/src/core/Directus/Application/CoreServicesProvider.php(344): Directus\Application\CoreServicesProvider->Directus\Application\{closure}(Object(Directus\Hook\Payload), false)               
#8 [internal function]: Directus\Application\CoreServicesProvider->Directus\Application\{closure}(Object(Directus\Hook\Payload))                                                                           
#9 /var/www/api/src/core/Directus/Hook/Emitter.php(291): call_user_func_array(Object(Closure), Array)                                                                                                      
#10 /var/www/api/src/core/Directus/Hook/Emitter.php(151): Directus\Hook\Emitter->executeListeners(Array, Array, 1)                                                                                         
#11 /var/www/api/src/core/Directus/Database/TableGateway/BaseTableGateway.php(1528): Directus\Hook\Emitter->apply('item.create:bef...', Array, Array)                                                      
#12 /var/www/api/src/core/Directus/Database/TableGateway/BaseTableGateway.php(778): Directus\Database\TableGateway\BaseTableGateway->applyHook('item.create:bef...', Array, Array)                         
#13 /var/www/api/vendor/zendframework/zend-db/src/TableGateway/AbstractTableGateway.php(264): Directus\Database\TableGateway\BaseTableGateway->executeInsert(Object(Zend\Db\Sql\Insert))                   
#14 /var/www/api/src/core/Directus/Database/TableGateway/BaseTableGateway.php(389): Zend\Db\TableGateway\AbstractTableGateway->insert(Array)                                                               
#15 /var/www/api/src/core/Directus/Database/TableGateway/RelationalTableGateway.php(403): Directus\Database\TableGateway\BaseTableGateway->addRecordByArray(Array)                                         
#16 /var/www/api/src/core/Directus/Services/FilesServices.php(36): Directus\Database\TableGateway\RelationalTableGateway->createRecord(Array, Array)                                                       
#17 /var/www/api/src/endpoints/Files.php(86): Directus\Services\FilesServices->create(Array, Array)                                                                                                        
#18 [internal function]: Directus\Api\Routes\Files->create(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Array)                                                   
#19 /var/www/api/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(41): call_user_func(Array, Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Array)    
#20 /var/www/api/vendor/slim/slim/Slim/Route.php(356): Slim\Handlers\Strategies\RequestResponse->__invoke(Array, Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Arra
y)                                                                                                                                                                                                         
#21 /var/www/api/src/core/Directus/Application/Http/Middleware/AbstractRateLimitMiddleware.php(34): Slim\Route->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Respons
e))                                                                                                                                                                                                        
#22 [internal function]: Directus\Application\Http\Middleware\AbstractRateLimitMiddleware->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Slim\Route
))                                                                                                                                                                                                         
#23 /var/www/api/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Directus\Application\Http\Middleware\UserRateLimitMiddleware), Array)                                         
#24 [internal function]: Slim\DeferredCallable->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Slim\Route))                                        
#25 /var/www/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Ob
ject(Slim\Route))                                                                                                                                                                                          
#26 /var/www/api/src/core/Directus/Application/Http/Middleware/AuthenticationMiddleware.php(80): Slim\Route->Slim\{closure}(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Resp
onse))                                                                                                                                                                                                     
#27 [internal function]: Directus\Application\Http\Middleware\AuthenticationMiddleware->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Closure))   
#28 /var/www/api/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Directus\Application\Http\Middleware\AuthenticationMiddleware), Array)                                        
#29 [internal function]: Slim\DeferredCallable->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Closure))                                           
#30 /var/www/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Ob
ject(Closure))                                                                                                                                                                                             
#31 /var/www/api/src/core/Directus/Application/Http/Middleware/TableGatewayMiddleware.php(25): Slim\Route->Slim\{closure}(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Respon
se))                                                                                                                                                                                                       
#32 [internal function]: Directus\Application\Http\Middleware\TableGatewayMiddleware->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Closure))     
#33 /var/www/api/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Directus\Application\Http\Middleware\TableGatewayMiddleware), Array)                                          
#34 [internal function]: Slim\DeferredCallable->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Closure))                                           
#35 /var/www/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Ob
ject(Closure))                                                                                                                                                                                             
#36 /var/www/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->Slim\{closure}(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response))                    
#37 /var/www/api/vendor/slim/slim/Slim/Route.php(334): Slim\Route->callMiddlewareStack(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response))                              
#38 /var/www/api/vendor/slim/slim/Slim/App.php(515): Slim\Route->run(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response))                                                
#39 /var/www/api/src/core/Directus/Application/Http/Middleware/AbstractRateLimitMiddleware.php(34): Slim\App->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response)
)                                                                                                                                                                                                          
#40 [internal function]: Directus\Application\Http\Middleware\AbstractRateLimitMiddleware->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Directus\A
pplication\Application))                                                                                                                                                                                   
#41 /var/www/api/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Directus\Application\Http\Middleware\IpRateLimitMiddleware), Array)                                           
#42 [internal function]: Slim\DeferredCallable->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Directus\Application\Application))                  
#43 /var/www/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Ob
ject(Directus\Application\Application))                                                                                                                                                                    
#44 /var/www/api/vendor/akrabat/rka-ip-address-middleware/src/IpAddress.php(93): Slim\App->Slim\{closure}(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response))           
#45 [internal function]: RKA\Middleware\IpAddress->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Closure))                                        
#46 /var/www/api/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(RKA\Middleware\IpAddress), Array)                                                                             
#47 [internal function]: Slim\DeferredCallable->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Closure))                                           
#48 /var/www/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Ob
ject(Closure))                                                                                                                                                                                             
#49 /var/www/api/src/core/Directus/Application/Http/Middleware/CorsMiddleware.php(66): Slim\App->Slim\{closure}(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response))     
#50 [internal function]: Directus\Application\Http\Middleware\CorsMiddleware->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Closure))             
#51 /var/www/api/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Directus\Application\Http\Middleware\CorsMiddleware), Array)                                                  
#52 [internal function]: Slim\DeferredCallable->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Closure))                                           
#53 /var/www/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Ob
ject(Closure))                                                                                                                                                                                             
#54 /var/www/api/src/core/Directus/Application/Http/Middleware/ResponseCacheMiddleware.php(47): Slim\App->Slim\{closure}(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Respons
e))                                                                                                                                                                                                        
#55 [internal function]: Directus\Application\Http\Middleware\ResponseCacheMiddleware->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Closure))    
#56 /var/www/api/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Directus\Application\Http\Middleware\ResponseCacheMiddleware), Array)                                         
#57 [internal function]: Slim\DeferredCallable->__invoke(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Object(Closure))                                           
#58 /var/www/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response), Ob
ject(Closure))                                                                                                                                                                                             
#59 /var/www/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->Slim\{closure}(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response))                      
#60 /var/www/api/vendor/slim/slim/Slim/App.php(406): Slim\App->callMiddlewareStack(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response))                                  
#61 /var/www/api/vendor/slim/slim/Slim/App.php(314): Slim\App->process(Object(Directus\Application\Http\Request), Object(Directus\Application\Http\Response))                                              
#62 /var/www/api/src/core/Directus/Application/Application.php(161): Slim\App->run(false)
#63 /var/www/api/public/index.php(5): Directus\Application\Application->run()
#64 {main} [] []

@wellingguzman
Copy link
Contributor

It seems you are using an old version because the logs still have the arguments written down in the log files. (This has nothing to do).

I think the configuration file is missing the storage adapter and the api should return a better error message.

How the instance configuration file looks like? Is there a storage key in the configuration? Is this from a new install or an old installation?

@wellingguzman
Copy link
Contributor

The API throws a friendly error message that tells you when the storage configuration is missing.

Ref: b24a722, https://github.com/directus/docs/commit/84f1a1b925931c59f81d6e54ab290fa8d803305a

@wellingguzman
Copy link
Contributor

Due to inactivity I will close this ticket assuming there's nothing else to add to the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants