TypeError FileWidget::__construct(): Argument #5 ($third_party_settings) must be of type array, null given, called

Created on 18 December 2022, almost 2 years ago
Updated 8 May 2023, over 1 year ago

Problem/Motivation

When calling media/add/streaming_video i get the error

TypeError: Drupal\file\Plugin\Field\FieldWidget\FileWidget::__construct(): Argument #5 ($third_party_settings) must be of type array, null given, called in /var/www/html/docroot/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php on line 49 in Drupal\file\Plugin\Field\FieldWidget\FileWidget->__construct() (line 40 of core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php).

Steps to reproduce

I have a clean Varbase installation at latest stable. I was installing streaming module as described on the project page and enabling streaming_media_views.

Drupal: 9.5.0

The error will not come when using streaming:1.1.4

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

1.2

Component

Code

Created by

🇩🇪Germany fox_01

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany hhofer

    Thre is a third_party_settings: { } missing in streaming/modules/streaming_media_views/config/optional/core.entity_form_display.media.streaming_video.default.yml. It must be added to field_media_video_file. This was the solution to me. Sorry I don't know how to provide a diff patch.

  • 🇷🇺Russia allexim

    D9 php 8.1
    same matter for me without distinction of 'drupal/streaming:^1.1' or 'drupal/streaming:^1.2':

    TypeError: Drupal\file\Plugin\Field\FieldWidget\FileWidget::__construct(): Argument #5 
    ....................................................
    ..............................
    


    Warning: Undefined array key "third_party_settings" in Drupal\file\Plugin\Field\FieldWidget\FileWidget::create() (line 49 of core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php). 
    

    hence, it is the same wherever the streaming widget is being invoked:

    • /media/add/streaming_video
    • /admin/structure/media/manage/streaming_video/fields/media.streaming_video.field_playlist

    But the idea was good; worthy of praise.

  • 🇺🇸United States mr_scumbag Chattanooga TN USA

    I have the same problem.
    D9.5 php 8.1 - clean install, I just wanted to test the streaming out.
    Tried dropping back a version of "drupal/streaming" to 1.1 and it still gives me the same error.
    I'll poke about and see what I can find, maybe produce a patch.

  • 🇷🇺Russia allexim

    @mr_scumbag, cool! it seems, you are extremely skillful.
    i believe, you can cope with that.

    by the way, maybe, if you are fond of, i can share, how i directly embed streaming to a website.

  • 🇵🇰Pakistan Allahnoor Turab

    Same issue for me with D9.5 php 8.1

  • 🇮🇳India bhanu951

    Thanks for the comment in #4 by @hhofer , I am able to resolve the issue on 1.2.0 branch. It seems its already fixed in dev branch.

    Here is a patch for anyone who is looking for a patch.

    After applying patch run

    drush cim --partial --source=web/modules/contrib/streaming/modules/streaming_media_views/config/optional/
    

    and clear cache issue will get resolved.

  • Status changed to Needs review over 1 year ago
  • 🇮🇹Italy arturopanetta Grotteria (RC)

    Thanks @Bhanu951 for the patch, I'll release the updated version as soon as I can.

  • 🇷🇺Russia allexim

    i am not assured about running this after the patch:
    drush cim --partial --source=web/modules/contrib/streaming/modules/streaming_media_views/config/optional/

    [error] The source directory does not exist. The source is not a directory.

    But #9 has not worked for me:
    admin/structure/media/manage/streaming_video/form-display

    Still i have this:

    The website encountered an unexpected error. Please try again later.
    TypeError: Drupal\file\Plugin\Field\FieldWidget\FileWidget::__construct(): Argument #5 ($third_party_settings) must be of type array, null given, called in /var/www/websites/client0/domain1/drupal9-edition/web/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php on line 49 in Drupal\file\Plugin\Field\FieldWidget\FileWidget->__construct() (line 40 of core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php).
    
    ........................................................
    
    
  • 🇮🇳India bhanu951

    @allexim thats because you have different docroot.

    From the error message you posted your docroot seems /var/www/websites/client0/domain1/drupal9-edition/web/ try to pass the proper docroot to the source argument.

  • 🇷🇺Russia allexim

    #13

    my server' root doesn't really matter, i was running it properly from the root of the website

    (honestly, i am not familiar much with the drush tool)

  • 🇮🇳India bhanu951

    > my server' root doesn't really matter

    It does matter as source option requires absolute or relative path

    like

    drush cim --partial --source=/var/www/html/web/modules/contrib/streaming/modules/streaming_media_views/config/optional/

    or

    drush config-import --partial --source=../config/local/path

  • 🇷🇺Russia allexim

    @Bhanu951, you were right, Sir, it does depend on..!
    In my case, i am able to launch as:
    php81 ./vendor/bin/drush cim --partial --source=/var/www/websites/client0/domain1/drupal9-edition/web/modules/contrib/streaming/modules/streaming_media_views/config/optional/

    +------------+--------------------------------------------------------------+-----------+
    | Collection | Config                                                       | Operation |
    +------------+--------------------------------------------------------------+-----------+
    |            | field.storage.media.field_poster                             | Create    |
    |            | field.storage.media.field_playlist                           | Create    |
    |            | media.type.streaming_video                                   | Create    |
    |            | field.field.media.streaming_video.field_poster               | Create    |
    |            | field.field.media.streaming_video.field_playlist             | Create    |
    |            | field.field.media.streaming_video.field_media_video_file     | Create    |
    |            | core.entity_view_display.media.streaming_video.default       | Create    |
    |            | core.entity_view_display.media.streaming_video.media_library | Create    |
    |            | core.entity_form_display.media.streaming_video.media_library | Create    |
    |            | core.entity_form_display.media.streaming_video.default       | Create    |
    |            | field.storage.media.field_media_video_file                   | Update    |
    +------------+--------------------------------------------------------------+-----------+
    
     Import the listed configuration changes? (yes/no) [yes]:
     >
    
     [error]  Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization.
    Configuration <em class="placeholder">editor.editor.php_code</em> depends on the <em class="placeholder">filter.format.php_code</em> configuration that will not exist after import. in Drupal\Core\Config\ConfigImporter->validate() (line 788 of /var/www/websites/client0/domain1/drupal9-edition/web/core/lib/Drupal/Core/Config/ConfigImporter.php).
    
    In ConfigImportCommands.php line 324:
    
      The import failed due to the following reasons:
      Configuration <em class="placeholder">editor.editor.php_code</em> depends on the <em class="pla
      ceholder">filter.format.php_code</em> configuration that will not exist after import.
    
    
    

    Although there is some error yet (even with php-filter disabled), but now no more obstacles for the module to work.
    Thank you!

    For such an occasion, could you explain to me why we need to run this drush string if we have already patched the module?

  • 🇮🇳India bhanu951

    > could you explain to me why we need to run this drush string if we have already patched the module?

    @allexim : exported config files are noting but database definitions exported to file system.

    And config changes normally only get reflected from file system into database only during module install, uninstall and update hook execution. As we made changes to config files in file system we need to import them into database.

    Which can be done through module reinstall or update hook, additionally you can import single file with drush as well. Which we performed in above command.

  • 🇷🇺Russia allexim

    #17, @Bhanu951, i bit disagree, because preliminary had uninstalled module and only after that reinstalled with the changes already made.

    And the try was unsuccessful until executing drush.
    Probably, the module itself doesn't clean properly while the uninstall procedure.

    Thanks for your explanation, Bhanu!

  • 🇷🇺Russia allexim

    Dear @arturopanetta, after pushing transcode task, it has given a full load to my server
    and then has gone away with "503"

    Does it behave the same way for you or anyone else?

  • 🇮🇹Italy arturopanetta Grotteria (RC)

    #19 Hi @allexim about the 503 error I mentioned it in https://www.drupal.org/project/streaming/issues/3305459#comment-14671382 . As for the load you can choose the number of Threads to use from the PHP FFMpeg settings

  • 🇮🇹Italy arturopanetta Grotteria (RC)

    #18 @allexim No, when uninstalling the module it doesn't delete user-created content, it's a deliberate choice (deleting content didn't seem like a good choice).

Production build 0.71.5 2024