BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
15.36k stars 1.92k forks source link

Call to a member function bind() on null after update from 0.29.3 to 0.31.6 #2585

Closed col-panic closed 3 years ago

col-panic commented 3 years ago

Describe the bug We updated an existing dockerized bookstack installation from 0.29.3 to 0.31.6. Most of it seems to work ok, but the uploaded images are not accessible anymore. The error shown is as follows in laravel.log

[2021-02-24 08:39:59] production.ERROR: Call to a member function bind() on null {"userId":3,"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function bind() on null at /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Support/HigherOrderTapProxy.php:34)
[stacktrace]
#0 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Router.php(598): Illuminate\\Support\\HigherOrderTapProxy->__call('bind', Array)
#1 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\\Routing\\Router->respondWithRoute('fallback')
#2 /var/www/bookstack/app/Exceptions/Handler.php(77): Illuminate\\Support\\Facades\\Facade::__callStatic('respondWithRout...', Array)
#3 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(51): BookStack\\Exceptions\\Handler->render(Object(BookStack\\Http\\Request), Object(Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException))
#4 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(132): Illuminate\\Routing\\Pipeline->handleException(Object(BookStack\\Http\\Request), Object(Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException))
#5 /var/www/bookstack/app/Http/Middleware/Authenticate.php(29): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#6 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): BookStack\\Http\\Middleware\\Authenticate->handle(Object(BookStack\\Http\\Request), Object(Closure))
#7 /var/www/bookstack/app/Http/Middleware/GlobalViewData.php(25): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#8 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): BookStack\\Http\\Middleware\\GlobalViewData->handle(Object(BookStack\\Http\\Request), Object(Closure))
#9 /var/www/bookstack/app/Http/Middleware/Localization.php(76): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#10 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): BookStack\\Http\\Middleware\\Localization->handle(Object(BookStack\\Http\\Request), Object(Closure))
#11 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#12 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(BookStack\\Http\\Request), Object(Closure))
#13 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#14 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(BookStack\\Http\\Request), Object(Closure))
#15 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(56): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#16 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Session\\Middleware\\StartSession->handle(Object(BookStack\\Http\\Request), Object(Closure))
#17 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#18 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(BookStack\\Http\\Request), Object(Closure))
#19 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#20 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(BookStack\\Http\\Request), Object(Closure))
#21 /var/www/bookstack/app/Http/Middleware/ControlIframeSecurity.php(31): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#22 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): BookStack\\Http\\Middleware\\ControlIframeSecurity->handle(Object(BookStack\\Http\\Request), Object(Closure))
#23 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#24 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Router.php(683): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#25 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(BookStack\\Http\\Request))
#26 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\\Routing\\Router->runRoute(Object(BookStack\\Http\\Request), Object(Illuminate\\Routing\\Route))
#27 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Routing/Router.php(613): Illuminate\\Routing\\Router->dispatchToRoute(Object(BookStack\\Http\\Request))
#28 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(170): Illuminate\\Routing\\Router->dispatch(Object(BookStack\\Http\\Request))
#29 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(BookStack\\Http\\Request))
#30 /var/www/bookstack/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(60): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#31 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(BookStack\\Http\\Request), Object(Closure))
#32 /var/www/bookstack/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#33 /var/www/bookstack/app/Http/Middleware/TrustProxies.php(39): Fideloper\\Proxy\\TrustProxies->handle(Object(BookStack\\Http\\Request), Object(Closure))
#34 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): BookStack\\Http\\Middleware\\TrustProxies->handle(Object(BookStack\\Http\\Request), Object(Closure))
#35 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#36 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(BookStack\\Http\\Request), Object(Closure))
#37 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#38 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(BookStack\\Http\\Request), Object(Closure))
#39 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#40 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(BookStack\\Http\\Request), Object(Closure))
#41 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(BookStack\\Http\\Request))
#42 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#43 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(BookStack\\Http\\Request))
#44 /var/www/bookstack/public/index.php(56): Illuminate\\Foundation\\Http\\Kernel->handle(Object(BookStack\\Http\\Request))
#45 {main}
"} 

Startup itself worked ok:

bookstack_1           | wait-for-db: waiting for "192.168.54.3:3306"
bookstack_1           | Generating key ...
bookstack_1           | wait-for-db: done
bookstack_1           | **************************************
bookstack_1           | *     Application In Production!     *
bookstack_1           | **************************************
bookstack_1           | 
bookstack_1           |  Do you really wish to run this command? (yes/no) [no]:
bookstack_1           |  > Command Canceled!
bookstack_1           | Starting migration ...
bookstack_1           | Migrating: 2020_08_04_111754_drop_joint_permissions_id
bookstack_1           | Migrated:  2020_08_04_111754_drop_joint_permissions_id (1.09 seconds)
bookstack_1           | Migrating: 2020_08_04_131052_remove_role_name_field
bookstack_1           | Migrated:  2020_08_04_131052_remove_role_name_field (0.1 seconds)
bookstack_1           | Migrating: 2020_09_19_094251_add_activity_indexes
bookstack_1           | Migrated:  2020_09_19_094251_add_activity_indexes (0.1 seconds)
bookstack_1           | Migrating: 2020_09_27_210059_add_entity_soft_deletes
bookstack_1           | Migrated:  2020_09_27_210059_add_entity_soft_deletes (0.65 seconds)
bookstack_1           | Migrating: 2020_09_27_210528_create_deletions_table
bookstack_1           | Migrated:  2020_09_27_210528_create_deletions_table (0.1 seconds)
bookstack_1           | Migrating: 2020_11_07_232321_simplify_activities_table
bookstack_1           | Migrated:  2020_11_07_232321_simplify_activities_table (0.43 seconds)
bookstack_1           | Migrating: 2020_12_30_173528_add_owned_by_field_to_entities
bookstack_1           | Migrated:  2020_12_30_173528_add_owned_by_field_to_entities (0.82 seconds)
bookstack_1           | Setting folder permissions for uploads ...
bookstack_1           | Clearing caches ...
bookstack_1           | Application cache cleared!
bookstack_1           | Compiled views cleared!
bookstack_1           | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.6. Set the 'ServerName' directive globally to suppress this message
bookstack_1           | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.6. Set the 'ServerName' directive globally to suppress this message
bookstack_1           | [Wed Feb 24 08:21:50.015429 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.15 configured -- resuming normal operations
bookstack_1           | [Wed Feb 24 08:21:50.015481 2021] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

A request to a respective image shows HTTP 500

bookstack_1           | bookstack:80 172.18.0.14 - - [24/Feb/2021:08:45:43 +0000] "GET //uploads/images/gallery/2020-07/scaled-1680-/Organigramm.jpg HTTP/1.1" 500 286704 "https://redacted.com/bookstack/books/firma-praxis/page/organigramm" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0"

Steps To Reproduce Update an existing 0.29.3 installation to 0.31.6.

Expected behavior The images should be shown as before.

Screenshots error

Your Configuration (please complete the following information):

Additional context Add any other context about the problem here.

col-panic commented 3 years ago

It seems that this error is related to a referenced missing image. That is, we have existing books/pages that reference images in the upload directory that have gone missing. With a different setup we did not face this error anymore!

thanks a lot!