Export with assets for s3 not working

Created on 25 May 2023, over 1 year ago
Updated 12 September 2023, over 1 year ago

I already read this issue here https://www.drupal.org/project/single_content_sync/issues/3321021 πŸ› Export functionality does not work with the S3 file system Fixed

mean in previous version the export with assets for s3 already fixe, but i get this issue with last version `"drupal/single_content_sync": "^1.3"` / 1.3.15

error message:

```
The website encountered an unexpected error. Please try again later.
TypeError: Drupal\single_content_sync\ContentSyncHelper::createZipInstance(): Return value must be of type Drupal\Core\Archiver\ArchiverInterface, null returned in Drupal\single_content_sync\ContentSyncHelper->createZipInstance() (line 158 of modules/contrib/single_content_sync/src/ContentSyncHelper.php).
Drupal\single_content_sync\ContentSyncHelper->createZipInstance('', 8) (Line: 87)
Drupal\single_content_sync\ContentFileGenerator->generateZipFile(Object, ) (Line: 228)
Drupal\single_content_sync\Form\ContentExportForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('single_content_sync_export_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
```

πŸ› Bug report
Status

Fixed

Version

1.3

Component

Code

Created by

πŸ‡²πŸ‡¦Morocco kamalMaroc

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @kamalMaroc
  • I'm also experiancig this issue and would love a fix. I'm using the S3FS Module (8.x-3.2) as well.

    TypeError: Drupal\single_content_sync\ContentSyncHelper::createZipInstance(): Return value must be of type Drupal\Core\Archiver\ArchiverInterface, null returned in Drupal\single_content_sync\ContentSyncHelper->createZipInstance() (line 158 of /var/app/current/html/web/modules/contrib/single_content_sync/src/ContentSyncHelper.php)

  • πŸ‡ΊπŸ‡¦Ukraine nginex

    Thanks for the feedback, I'm going to test the module with some basic s3 set up.

  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡ΊπŸ‡¦Ukraine nginex

    Hi @tbadaczewski and @kamalMaroc,

    I just finished testing drupal 10 with s3 setup and I cound not reproduce the issue, in my case the zip file was generated without problems.

    Please provide more details:

    - which drupal core version is used
    - which "Default download method" is used (check on /admin/config/media/file-system)
    - which PHP version is used

  • Drupal Version: 9.5.9
    Default Download Method: Public files served from Amazon S3.
    PHP: 8.0.28

    I tried changing the "Default Download Method" to "Private local files served by Drupal." because that seemed like it could solve it, but I recieve the same error. Ran a "drush updatedb" and "drush cr" after change to make sure everythign was refreshed.

    I'm trying to export by checking multuiple content items from the "/admin/content" window and then using the "Export content" action to "Apply to selected items". I check "Include all assets" and "Include all translation"s, but it fails even if those are not checked.

    	TypeError: Drupal\single_content_sync\ContentSyncHelper::createZipInstance(): Return value must be of type Drupal\Core\Archiver\ArchiverInterface, null returned in Drupal\single_content_sync\ContentSyncHelper->createZipInstance() (line 158 of /var/app/current/html/web/modules/contrib/single_content_sync/src/ContentSyncHelper.php)
    #0 /var/app/current/html/web/modules/contrib/single_content_sync/src/ContentFileGenerator.php(108): Drupal\single_content_sync\ContentSyncHelper->createZipInstance('', 8)
    #1 /var/app/current/html/web/modules/contrib/single_content_sync/src/Form/ContentBulkExportForm.php(144): Drupal\single_content_sync\ContentFileGenerator->generateBulkZipFile(Array, false, false)
    #2 [internal function]: Drupal\single_content_sync\Form\ContentBulkExportForm->submitForm(Array, Object(Drupal\Core\Form\FormState))
    #3 /var/app/current/html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array(Array, Array)
    #4 /var/app/current/html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
    #5 /var/app/current/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
    #6 /var/app/current/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('single_content_...', Array, Object(Drupal\Core\Form\FormState))
    #7 /var/app/current/html/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\single_content_sync\Form\ContentBulkExportForm), Object(Drupal\Core\Form\FormState))
    #8 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
    #9 /var/app/current/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #10 /var/app/current/html/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #11 /var/app/current/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #12 /var/app/current/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #13 /var/app/current/html/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #14 /var/app/current/html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #15 /var/app/current/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #16 /var/app/current/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #17 /var/app/current/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #18 /var/app/current/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #19 /var/app/current/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #20 /var/app/current/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #21 /var/app/current/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #22 /var/app/current/html/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #23 /var/app/current/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #24 {main}
  • πŸ‡ΊπŸ‡¦Ukraine nginex

    Hi @tbadaczewski,

    Thanks for more details, could you please try with "Public local files served by the webserver" as Default Download Method.

  • And the S3 File System Module I'm using is version 8.x-3.2

    https://www.drupal.org/project/s3fs β†’

  • I don't appear to have that option since I'm using the S3FS module. I did try "Amazon Simple Storage Service", but it was the same error. I've attached a screenshot.

  • πŸ‡ΊπŸ‡¦Ukraine nginex

    I think that's the issue, it seems like you do not have public schema, currently zip can only be created by using public file schema

  • The reports status page clears the checks for the filesystem and S3FS Public Processing,

    FILE SYSTEM: Writable (public download method)

    S3FS PUBLIC:// TAKEOVER Enabled

    S3FS is processing public:// file requests.

  • This is interesting. I see that the "content-bulk-export-XXXXXX.zip" zip files do get created and sent to S3, but they are all 0 B.

    I've attached a screenshot.

  • πŸ‡ΊπŸ‡¦Ukraine nginex

    Try to revert this change locally and see if the bug disappear

    https://git.drupalcode.org/project/single_content_sync/-/commit/b1c562d4...

  • I'm getting the same error, but on a different line after using the changes.

    Location https://XXXXXXX/admin/content/bulk-export?destination=%2Fadmin%2Fcontent
    Referrer https://XXXXXXX/admin/content/bulk-export?destination=/admin/content

    TypeError: Drupal\single_content_sync\ContentSyncHelper::createZipInstance(): Return value must be of type Drupal\Core\Archiver\ArchiverInterface, null returned in Drupal\single_content_sync\ContentSyncHelper->createZipInstance() (line 147 of /var/app/current/html/web/modules/contrib/single_content_sync/src/ContentSyncHelper.php)
    #0 /var/app/current/html/web/modules/contrib/single_content_sync/src/ContentFileGenerator.php(105): Drupal\single_content_sync\ContentSyncHelper->createZipInstance('', 8)
    #1 /var/app/current/html/web/modules/contrib/single_content_sync/src/Form/ContentBulkExportForm.php(168): Drupal\single_content_sync\ContentFileGenerator->generateBulkZipFile(Array, false, false)
    #2 [internal function]: Drupal\single_content_sync\Form\ContentBulkExportForm->submitForm(Array, Object(Drupal\Core\Form\FormState))
    #3 /var/app/current/html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array(Array, Array)
    #4 /var/app/current/html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
    #5 /var/app/current/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
    #6 /var/app/current/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('single_content_...', Array, Object(Drupal\Core\Form\FormState))
    #7 /var/app/current/html/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\single_content_sync\Form\ContentBulkExportForm), Object(Drupal\Core\Form\FormState))
    #8 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
    #9 /var/app/current/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
    #10 /var/app/current/html/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #11 /var/app/current/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #12 /var/app/current/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
    #13 /var/app/current/html/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #14 /var/app/current/html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #15 /var/app/current/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #16 /var/app/current/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #17 /var/app/current/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #18 /var/app/current/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #19 /var/app/current/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #20 /var/app/current/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #21 /var/app/current/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #22 /var/app/current/html/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #23 /var/app/current/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #24 {main}
  • πŸ‡²πŸ‡¦Morocco kamalMaroc

    @nginex first of all thank you for help us,
    any update to fixe this issue ??

    thank you

  • πŸ‡²πŸ‡¦Morocco kamalMaroc

    @tbadaczewski are u found any others solution ??

  • Assigned to nginex
  • Status changed to Active over 1 year ago
  • πŸ‡ΊπŸ‡¦Ukraine nginex

    I could reproduce the issue when s3fs.upload_as_private is TRUE, I'm going to fix it ASAP

  • @nginex opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡¦Ukraine nginex

    Guys, could you please test the fix I provided in new MR, It worked it my case really well

  • πŸ‡²πŸ‡¦Morocco kamalMaroc

    @nginex which version should to install ??

  • πŸ‡ΊπŸ‡¦Ukraine nginex

    @kamalMaroc, let me create a new patch release now, I will keep you posted

    • nginex β†’ committed d4e25652 on 1.3.x
      Issue #3362720: Use temporary file schema for exporting/importing zip.
      
  • Status changed to Fixed over 1 year ago
  • πŸ‡ΊπŸ‡¦Ukraine nginex

    @kamalMaroc,

    Here is a new release with the fix https://www.drupal.org/project/single_content_sync/releases/1.3.17 β†’

    I'm going to backport it to 1.4.x

    • nginex β†’ committed 97f444dc on 1.4.x
      Issue #3362720: Use temporary file schema for exporting/importing zip.
      
  • πŸ‡ΊπŸ‡¦Ukraine nginex

    External file import issue has been fixed in πŸ› External assets from S3 are not correctly importing Fixed

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024