Problem/Motivation
Not sure if this is evidence of a bug, or my ignorance.
For any document uploaded to Drupal and edited in ONLYOFFICE, the content of the file loads into only office, users are able to edit the file, but when the file saves back to Drupal upon ONLYOFFICE session end, the original document is overwritten with a blank document (0 bytes). Both ONLYOFFICE and Drupal are each in separate docker stacks on different networks.
The issue is not document-type specific. This occurs for text docs, spreadsheets, and presentations. The title remains the same, but the contents are overwritten as blank.
Drupal 9.5.8, Kubernetes/docker, Apache and Nginx reverse proxy
ONLYOFFICE Docs Community Edition Docker, no configuration changes, in a temporary github codespace
Steps to reproduce
- Go to the Content > Media
- Add a docx document and save
- From Content > Media, select 'edit in ONLYOFFICE' from the dropdown
- Make changes to the file, close out onlyoffice session
- Either download the file, or open it again on ONLYOFFICE - file is blank, and is now 0 bytes size
There is nothing coming up in the ONLYOFFICE logs that would point to an issue.
In the Drupal logs, we see that the config is generated for the document with what looks like all the correct information, and "Connected to the media document REDACTED.docx co-editing." appears in the logs, along with the "Request from Document Editing Service" json. When the session is closed, Media document "REDACTED.docx was successfully saved." prints to the Drupal log.
We do get several warnings in the logs related to the callback, which likely explain why the document does not save back properly, all citing line 287 of OnlyofficeCallbackController.php. I am pasting them here, with the stack trace:
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in Drupal\onlyoffice\Controller\OnlyofficeCallbackController->proccessSave() (line 287 of /var/www/html/web/modules/contrib/onlyoffice/src/Controller/OnlyofficeCallbackController.php)
#0 /var/www/html/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real(2, 'file_get_conten...', '/var/www/html/w...', 287)
#1 [internal function]: _drupal_error_handler(2, 'file_get_conten...', '/var/www/html/w...', 287)
#2 /var/www/html/web/modules/contrib/onlyoffice/src/Controller/OnlyofficeCallbackController.php(287): file_get_contents('https://kelizol...')
#3 /var/www/html/web/modules/contrib/onlyoffice/src/Controller/OnlyofficeCallbackController.php(242): Drupal\onlyoffice\Controller\OnlyofficeCallbackController->proccessSave(Object(stdClass), Object(Drupal\media\Entity\Media), Array)
#4 [internal function]: Drupal\onlyoffice\Controller\OnlyofficeCallbackController->callback('amZPY0RoRzZlMGc...', Object(Symfony\Component\HttpFoundation\Request))
#5 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#6 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#7 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#8 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#9 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#10 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#11 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#12 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#20 {main}
.
Warning: file_get_contents(): Failed to enable crypto in Drupal\onlyoffice\Controller\OnlyofficeCallbackController->proccessSave() (line 287 of /var/www/html/web/modules/contrib/onlyoffice/src/Controller/OnlyofficeCallbackController.php)
#0 /var/www/html/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real(2, 'file_get_conten...', '/var/www/html/w...', 287)
#1 [internal function]: _drupal_error_handler(2, 'file_get_conten...', '/var/www/html/w...', 287)
#2 /var/www/html/web/modules/contrib/onlyoffice/src/Controller/OnlyofficeCallbackController.php(287): file_get_contents('https://kelizol...')
#3 /var/www/html/web/modules/contrib/onlyoffice/src/Controller/OnlyofficeCallbackController.php(242): Drupal\onlyoffice\Controller\OnlyofficeCallbackController->proccessSave(Object(stdClass), Object(Drupal\media\Entity\Media), Array)
#4 [internal function]: Drupal\onlyoffice\Controller\OnlyofficeCallbackController->callback('amZPY0RoRzZlMGc...', Object(Symfony\Component\HttpFoundation\Request))
#5 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#6 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#7 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#8 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#9 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#10 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#11 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#12 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#20 {main}
.
Warning: file_get_contents(https://REDACTED.github.dev/cache/files/data/b7c66e33-4fbd-41b8-96b1-d46adbf08abc_MTY4NDc5NzIwMw==_664/output.pptx/output.pptx?md5=Eocbj0kGiL-u15Np5qbUHw&expires=1684800427&filename=output.pptx): Failed to open stream: operation failed in Drupal\onlyoffice\Controller\OnlyofficeCallbackController->proccessSave() (line 287 of /var/www/html/web/modules/contrib/onlyoffice/src/Controller/OnlyofficeCallbackController.php)
#0 /var/www/html/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real(2, 'file_get_conten...', '/var/www/html/w...', 287)
#1 [internal function]: _drupal_error_handler(2, 'file_get_conten...', '/var/www/html/w...', 287)
#2 /var/www/html/web/modules/contrib/onlyoffice/src/Controller/OnlyofficeCallbackController.php(287): file_get_contents('https://kelizol...')
#3 /var/www/html/web/modules/contrib/onlyoffice/src/Controller/OnlyofficeCallbackController.php(242): Drupal\onlyoffice\Controller\OnlyofficeCallbackController->proccessSave(Object(stdClass), Object(Drupal\media\Entity\Media), Array)
#4 [internal function]: Drupal\onlyoffice\Controller\OnlyofficeCallbackController->callback('amZPY0RoRzZlMGc...', Object(Symfony\Component\HttpFoundation\Request))
#5 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#6 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#7 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#8 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#9 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#10 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#11 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#12 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#20 {main}
.