Error with upload file on page in admin panel

Hello, today I have some error with upload file on page in admin panel. Yesterday all was fine

When I upolad file I see this message:
TypeError: Cannot convert undefined or null to object
at Function.keys ()
at /user/plugins/admin/themes/grav/js/admin.min.js?44259f918f:4325:16
at /user/plugins/admin/themes/grav/js/admin.min.js?44259f918f:890:12

First argument to Stream::create() must be a string, resource or StreamInterface.

in logs file
[2022-11-14 17:18:50] grav.CRITICAL: Call to a member function cropZoom() on null - Trace: #0 D:\Openserver\domains\grav\user\plugins\flex-objects\classes\Controllers\AbstractController.php(127): Grav\Plugin\FlexObjects\Controllers\MediaController->actionMediaList() #1 D:\Openserver\domains\grav\user\plugins\flex-objects\classes\Admin\AdminController.php(1213): Grav\Plugin\FlexObjects\Controllers\AbstractController->handle() #2 D:\Openserver\domains\grav\user\plugins\flex-objects\classes\Admin\AdminController.php(1098): Grav\Plugin\FlexObjects\Admin\AdminController->forwardMediaTask() #3 D:\Openserver\domains\grav\user\plugins\flex-objects\classes\Admin\AdminController.php(1138): Grav\Plugin\FlexObjects\Admin\AdminController->taskMediaList() #4 D:\Openserver\domains\grav\user\plugins\flex-objects\classes\Admin\AdminController.php(1434): Grav\Plugin\FlexObjects\Admin\AdminController->taskListmedia() #5 D:\Openserver\domains\grav\user\plugins\flex-objects\flex-objects.php(587): Grav\Plugin\FlexObjects\Admin\AdminController->execute() #6 D:\Openserver\domains\grav\vendor\symfony\event-dispatcher\EventDispatcher.php(264): Grav\Plugin\FlexObjectsPlugin->onAdminPageInitialized() #7 D:\Openserver\domains\grav\vendor\symfony\event-dispatcher\EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() #8 D:\Openserver\domains\grav\vendor\symfony\event-dispatcher\EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners() #9 D:\Openserver\domains\grav\system\src\Grav\Common\Grav.php(597): Symfony\Component\EventDispatcher\EventDispatcher->dispatch() #10 D:\Openserver\domains\grav\system\src\Grav\Common\Processors\PagesProcessor.php(59): Grav\Common\Grav->fireEvent() #11 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\PagesProcessor->process() #12 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() #13 D:\Openserver\domains\grav\system\src\Grav\Common\Processors\TwigProcessor.php(38): Grav\Framework\RequestHandler\RequestHandler->handle() #14 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\TwigProcessor->process() #15 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() #16 D:\Openserver\domains\grav\system\src\Grav\Common\Processors\AssetsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle() #17 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\AssetsProcessor->process() #18 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() #19 D:\Openserver\domains\grav\system\src\Grav\Common\Processors\SchedulerProcessor.php(40): Grav\Framework\RequestHandler\RequestHandler->handle() #20 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\SchedulerProcessor->process() #21 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() #22 D:\Openserver\domains\grav\system\src\Grav\Common\Processors\BackupsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle() #23 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\BackupsProcessor->process() #24 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() #25 D:\Openserver\domains\grav\system\src\Grav\Common\Processors\TasksProcessor.php(69): Grav\Framework\RequestHandler\RequestHandler->handle() #26 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\TasksProcessor->process() #27 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() #28 D:\Openserver\domains\grav\user\plugins\admin\classes\plugin\Router.php(65): Grav\Framework\RequestHandler\RequestHandler->handle() #29 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Plugin\Admin\Router->process() #30 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() #31 D:\Openserver\domains\grav\system\src\Grav\Common\Processors\RequestProcessor.php(64): Grav\Framework\RequestHandler\RequestHandler->handle() #32 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\RequestProcessor->process() #33 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() #34 D:\Openserver\domains\grav\system\src\Grav\Common\Processors\ThemesProcessor.php(38): Grav\Framework\RequestHandler\RequestHandler->handle() #35 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\ThemesProcessor->process() #36 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() #37 D:\Openserver\domains\grav\system\src\Grav\Common\Processors\PluginsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle() #38 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\PluginsProcessor->process() #39 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() #40 D:\Openserver\domains\grav\system\src\Grav\Common\Processors\InitializeProcessor.php(130): Grav\Framework\RequestHandler\RequestHandler->handle() #41 D:\Openserver\domains\grav\system\src\Grav\Common\Debugger.php(546): Grav\Common\Processors\InitializeProcessor::Grav\Common\Processors{closure}() #42 D:\Openserver\domains\grav\system\src\Grav\Common\Processors\InitializeProcessor.php(131): Grav\Common\Debugger->profile() #43 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\InitializeProcessor->process() #44 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() #45 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Middlewares\MultipartRequestSupport.php(40): Grav\Framework\RequestHandler\RequestHandler->handle() #46 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Framework\RequestHandler\Middlewares\MultipartRequestSupport->process() #47 D:\Openserver\domains\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle() #48 D:\Openserver\domains\grav\system\src\Grav\Common\Grav.php(312): Grav\Framework\RequestHandler\RequestHandler->handle() #49 D:\Openserver\domains\grav\index.php(47): Grav\Common\Grav->process() #50 {main}

So what’s the solution? It’s much better to reply to your own post explaining what fixed it and mark that post as a solution, than just editing a topic title to "Solved… " :thinking:

1 Like

honestly I do not know. But when deleting some photos from the page from the media library, the error goes away

What image types have you been using? *.avif perhaps?

no, only jpg. All files approximately 1000 pixels on the long side and 300 on the smaller side and max 400mb.

if i delete all files to which the system generates a file filename.jpg.meta.yaml then the error goes away

I’m not sure if I can put a link to a video here, but I made a video to show what’s going on. I’m desperate

Does this happen with only this specific file?

this is with all the photos that I upload. Before that everything was fine. But a couple of days ago this problem started appearing.

But in your video first file uploaded without any issue. Does it always upload first one on page without a problem, but the next one causes issues? Also in your screenshot avove there are more than 10 images uploaded. Did you get an error on each of them?

Yes, the problem occurs with any file. But. Sometimes it happens that the file that was uploaded first has no problems with it, although there were before that if it was uploaded later. I have already saved the files and changed the file type to png. Renamed. All the same, one will be loaded, the rest will not be loaded.

Now I tried to download all the files at once. Of these, only three were loaded. And while uploading to other files, an error appeared - First argument to Stream::create() must be a string, resource or StreamInterface.

@NataliaB, What has changed since yesterday? Software usually doesn’t magically change it behaviour overnight…

None. The code has not been edited. I just transfer articles from wordpress to grav.
I don’t know why this happens. Now I have transferred the article, uploaded the photos and everything is ok. But, the photos were not uploaded through the admin panel. And I saved it right away in the article folder. After uploading photos, in the admin panel on the article editing page, I clicked -Save-. And all 30 photos are successfully displayed.

It’s street magic :smiley:

@NataliaB, I can reproduce the error when doing the following:

  • Upload a few files and Save (no errors thrown)
  • Then using vscode, I delete a file
  • Refresh Admin. => Error thrown.

When refreshing, Admin tries to cropZoom the images from disk, but one of the images doesn’t exist. Hence the error “Call to a member function cropZoom() on null” in the log file.

I see in your video, that you are receiving another error when selecting a second image using the filepicker: “First argument to stream::create() must be a string, Resource or StreamInterface…”. That may have created a difference between Admin’s list of files compared to the files on disk.

Hi, but why is this happening?

@NataliaB, Once you can provide a reproducible case which we can replay, we might investigate the cause. Currently I can only reproduce the “cropZoom” error when deliberately fooling Admin by deleting one of the uploaded files…