- Issue created by @a.crowe
- Status changed to Postponed: needs info
about 1 year ago 11:58am 25 October 2023 - πΊπ¦Ukraine abramm Lutsk
Hi @a.crowe,
Can you please post the exact error and stack trace? Sorry, My account was blocked as I hadn't disabled add blockers!
The stack trace is as follows,
Many thanks.
Andy
drupal@d10dev:/var/www/d10dev.opengroup.org$ drush content:export
Executing drush content:export node
[error] Error: Call to a member function getFileUri() on null in Drupal\single_content_sync\Plugin\SingleContentSyncFieldProcessor\FileAsset->exportFieldValue() (line 117 of /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/Plugin/SingleContentSyncFieldProcessor/FileAsset.php) #0 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(355): Drupal\single_content_sync\Plugin\SingleContentSyncFieldProcessor\FileAsset->exportFieldValue()
#1 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(334): Drupal\single_content_sync\ContentExporter->getFieldValue()
#2 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(242): Drupal\single_content_sync\ContentExporter->exportCustomValues()
#3 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/Plugin/SingleContentSyncFieldProcessor/EntityReferenceRevisions.php(31): Drupal\single_content_sync\ContentExporter->doExportToArray()
#4 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(355): Drupal\single_content_sync\Plugin\SingleContentSyncFieldProcessor\EntityReferenceRevisions->exportFieldValue()
#5 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(334): Drupal\single_content_sync\ContentExporter->getFieldValue()
#6 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(242): Drupal\single_content_sync\ContentExporter->exportCustomValues()
#7 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(299): Drupal\single_content_sync\ContentExporter->doExportToArray()
#8 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentFileGenerator.php(67): Drupal\single_content_sync\ContentExporter->doExportToYml()
#9 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentFileGenerator.php(115): Drupal\single_content_sync\ContentFileGenerator->generateYamlFile()
#10 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/Commands/ContentSyncCommands.php(174): Drupal\single_content_sync\ContentFileGenerator->generateBulkZipFile()
#11 [internal function]: Drupal\single_content_sync\Commands\ContentSyncCommands->exportEntitiesCommand()
#12 /var/www/d10dev.opengroup.org/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#13 /var/www/d10dev.opengroup.org/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#14 /var/www/d10dev.opengroup.org/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#15 /var/www/d10dev.opengroup.org/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process()
#16 /var/www/d10dev.opengroup.org/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#17 /var/www/d10dev.opengroup.org/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run()
#18 /var/www/d10dev.opengroup.org/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand()
#19 /var/www/d10dev.opengroup.org/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun()
#20 /var/www/d10dev.opengroup.org/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run()
#21 /var/www/d10dev.opengroup.org/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun()
#22 /var/www/d10dev.opengroup.org/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run()
#23 /var/www/d10dev.opengroup.org/vendor/drush/drush/includes/preflight.inc(18): require('...')
#24 phar:///usr/local/bin/drush/bin/drush.php(143): drush_main()
#25 /usr/local/bin/drush(14): require('...')
#26 {main}.
Error: Call to a member function getFileUri() on null in /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/Plugin/SingleContentSyncFieldProcessor/FileAsset.php on line 117 #0 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(355): Drupal\single_content_sync\Plugin\SingleContentSyncFieldProcessor\FileAsset->exportFieldValue()
#1 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(334): Drupal\single_content_sync\ContentExporter->getFieldValue()
#2 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(242): Drupal\single_content_sync\ContentExporter->exportCustomValues()
#3 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/Plugin/SingleContentSyncFieldProcessor/EntityReferenceRevisions.php(31): Drupal\single_content_sync\ContentExporter->doExportToArray()
#4 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(355): Drupal\single_content_sync\Plugin\SingleContentSyncFieldProcessor\EntityReferenceRevisions->exportFieldValue()
#5 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(334): Drupal\single_content_sync\ContentExporter->getFieldValue()
#6 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(242): Drupal\single_content_sync\ContentExporter->exportCustomValues()
#7 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentExporter.php(299): Drupal\single_content_sync\ContentExporter->doExportToArray()
#8 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentFileGenerator.php(67): Drupal\single_content_sync\ContentExporter->doExportToYml()
#9 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/ContentFileGenerator.php(115): Drupal\single_content_sync\ContentFileGenerator->generateYamlFile()
#10 /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/Commands/ContentSyncCommands.php(174): Drupal\single_content_sync\ContentFileGenerator->generateBulkZipFile()
#11 [internal function]: Drupal\single_content_sync\Commands\ContentSyncCommands->exportEntitiesCommand()
#12 /var/www/d10dev.opengroup.org/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#13 /var/www/d10dev.opengroup.org/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#14 /var/www/d10dev.opengroup.org/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#15 /var/www/d10dev.opengroup.org/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process()
#16 /var/www/d10dev.opengroup.org/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#17 /var/www/d10dev.opengroup.org/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run()
#18 /var/www/d10dev.opengroup.org/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand()
#19 /var/www/d10dev.opengroup.org/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun()
#20 /var/www/d10dev.opengroup.org/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run()
#21 /var/www/d10dev.opengroup.org/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun()
#22 /var/www/d10dev.opengroup.org/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run()
#23 /var/www/d10dev.opengroup.org/vendor/drush/drush/includes/preflight.inc(18): require('...')
#24 phar:///usr/local/bin/drush/bin/drush.php(143): drush_main()
#25 /usr/local/bin/drush(14): require('...')
#26 {main}
Error: Call to a member function getFileUri() on null in Drupal\single_content_sync\Plugin\SingleContentSyncFieldProcessor\FileAsset->exportFieldValue() (line 117 of /var/www/d10dev.opengroup.org/web/modules/contrib/single_content_sync/src/Plugin/SingleContentSyncFieldProcessor/FileAsset.php).
[warning] Drush command terminated abnormally.- Status changed to Needs work
12 months ago 2:11pm 21 November 2023 - πΊπ¦Ukraine abramm Lutsk
Had a quick look in the code, it is possible that the issue is happening if the field is referencing non-existing file.
From FileAsset.php:
$file = $file_storage->load($item['target_id']); $file_item = [ 'uri' => $file->getFileUri(), 'url' => $file->createFileUrl(FALSE), ];
Just as a quick test, can you please add the following line after
$file = $file_storage->load($item['target_id']);
(line 114 in FileAsset.php)?if (!$file) { continue; }
Note this is not a correct fix, just a quick check to see if I guessed correctly.
That was a quick response, and worked a treat thanks. :-)
Now when I run it I get the following (success)
---------
drupal@d10dev:/var/www/d10dev.opengroup.org$ drush content:exportExecuting drush content:export node
[warning] Message: The value of /Comments/ is empty because field type "comment" is not
exportable out-of-the-box. Check README for a workaround.[warning] Message: The value of /Feeds item/ is empty because field type "feeds_item" is not
exportable out-of-the-box. Check README for a workaround.[notice] Message: Successfully exported the content. You can find the exported file at the
following location:
/var/www/d10dev.opengroup.org/web/scs-export/content-bulk-export-21_11_2023-09_31.zip
----------What is the next step to get this into a release?
Many thanks
Andy.
- Assigned to abramm
- πΊπ¦Ukraine abramm Lutsk
Thanks for a quick test!
I'll handle the rest, just wanted to make sure I guessed the correct reason for this.
Not sure about timing but I'm planning to get into this someday this week. - Merge request !89Issue #3396598: Call to a member function getFileUri() β (Merged) created by nginex
- Issue was unassigned.
- Status changed to Needs review
10 months ago 10:06am 27 January 2024 - Assigned to danmer
- Status changed to RTBC
10 months ago 11:36am 27 January 2024 -
nginex β
committed 80656c54 on 1.4.x
Issue #3396598: Call to a member function getFileUri()
-
nginex β
committed 80656c54 on 1.4.x
- Issue was unassigned.
- Status changed to Fixed
10 months ago 11:58am 27 January 2024 -
nginex β
committed 80656c54 on 2.0.x
Issue #3396598: Call to a member function getFileUri()
-
nginex β
committed 80656c54 on 2.0.x
Automatically closed - issue fixed for 2 weeks with no activity.