Media block isn't working on Drupal 10.3

Created on 25 June 2024, 5 months ago
Updated 24 July 2024, 4 months ago

With the Drupal 10.3 upgrade, the "Media" block breaks with Ajax error on media library modal opener

Not sure but appears to be related to this core issue πŸ› Adding media library openers use autoconfigure and tags in 10.3.x has BC consequences Active

The same error has been fixed on media library modify here as well πŸ› Use service decoration to replace media_library.opener.field_widget Needs review

Steps to reproduce

  • Upgrade to Drupal 10.3
  • Try to upload something in Media block
πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

  • Issue created by @doxigo
  • First commit to issue fork.
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    @doxigo thanks for commenting on the core issue - I think that MR attached might fix it. Can you test it?

  • Merge request !161Add autoconfigure β†’ (Merged) created by alexpott
  • Status changed to Needs review 5 months ago
  • πŸ‡΅πŸ‡ΉPortugal marcofernandes

    @alexpott That'll work. Thanks.
    Note that also adding the tags to the gutenberg.media_library.opener service would also work.

      gutenberg.media_library.opener:
        class: Drupal\gutenberg\MediaLibraryGutenbergOpener
        tags:
          - { name: media_library.opener }
    

    But, I guess, this way, we don't have to worry about other autoconfigurable services that may come up.

  • Pipeline finished with Failed
    5 months ago
    Total: 2237s
    #207739
  • πŸ‡΅πŸ‡ΉPortugal marcofernandes

    We're having issues on Gitlab CI, specifically on the phpunit (max PHP version) job:

    Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: The configuration key "autoconfigure" cannot be used to define a default value in "modules/custom/gutenberg-3456995/gutenberg.services.yml". Allowed keys are "public", "tags", "autowire".
    

    But it succeeds on the other phpunit jobs πŸ€”

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Given you support 9.5 maybe we can't do autoconfigure

  • Pipeline finished with Failed
    5 months ago
    Total: 4338s
    #207795
  • Thanks guys, and thanks for a quick patch Alex, I can confirm that this fixes the issue

  • Pipeline finished with Success
    4 months ago
    #217299
  • Status changed to Fixed 4 months ago
  • Pipeline finished with Success
    4 months ago
    Total: 241s
    #217448
  • Status changed to Active 4 months ago
  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    Issue exists on 8.x-2.x as well.

  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    szeidler β†’ changed the visibility of the branch 3456995-8.x-2.x to hidden.

  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    szeidler β†’ changed the visibility of the branch 3456995-8.x-2.x to active.

  • Status changed to Needs review 4 months ago
  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    Opened a MR

  • Pipeline finished with Success
    4 months ago
    Total: 260s
    #218157
  • Pipeline finished with Success
    4 months ago
    Total: 236s
    #218281
    • szeidler β†’ committed 509398e2 on 8.x-2.x
      Issue #3456995 by alexpott, szeidler, doxigo, marcofernandes: Media...
  • Status changed to Fixed 4 months ago
  • πŸ‡©πŸ‡ͺGermany szeidler Berlin
  • I also got this same issue with Drupal 10.3.1 upgrade, using PHP 8.1.28 on Acquia, and the Gutenberg module 8.x-2.9. Whenever I add a media block and upload a file to it, I can see the Ajax request to "/editor/media/upload/gutenberg". Not sure if it's the same Ajax error as the others that were reported, but before the JSON object is returned by the request above, I can see the following deprecation warning in the response:

    <br/><b>Deprecated</b>: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in <b>/mnt/www/html/hpdevportal3dev/docroot/core/lib/Drupal/Component/Utility/Bytes.php</b> on line <b>76</b><br/><br/><b>Deprecated</b>: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in <b>/mnt/www/html/hpdevportal3dev/docroot/core/lib/Drupal/Component/Utility/Bytes.php</b> on line <b>78</b><br/>

    The error persists, even after applying the patch that includes the "media_library.opener" tag to the "gutenberg.media_library.opener" service. The error wasn't happening in the 10.2.4, and curiously enough, it's happening only in our dev environment on Acquia Cloud, not happening in our local environments with Docksal.

    Is it something from the Drupal 10.3 upgrade? Or maybe something related with how PHP is configured to show notifications or not?

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

  • Pipeline finished with Success
    4 months ago
    Total: 143s
    #234209
  • Pipeline finished with Failed
    4 months ago
    Total: 753s
    #234939
  • Pipeline finished with Success
    4 months ago
    Total: 785s
    #234943
  • Pipeline finished with Success
    4 months ago
    Total: 878s
    #234955
  • Pipeline finished with Success
    4 months ago
    Total: 1403s
    #237294
  • Pipeline finished with Success
    4 months ago
    Total: 181s
    #239945
  • Pipeline finished with Success
    4 months ago
    Total: 187s
    #239970
  • Pipeline finished with Success
    4 months ago
    Total: 209s
    #239972
  • Pipeline finished with Failed
    4 months ago
    Total: 363s
    #240514
  • Pipeline finished with Skipped
    4 months ago
    #240739
  • Pipeline finished with Success
    4 months ago
    Total: 16586s
    #240525
  • Pipeline finished with Success
    4 months ago
    Total: 861s
    #241398
  • Pipeline finished with Success
    4 months ago
    Total: 583s
    #241546
  • Pipeline finished with Success
    4 months ago
    Total: 6069s
    #241578
  • Pipeline finished with Success
    3 months ago
    #242962
  • Pipeline finished with Success
    3 months ago
    Total: 272s
    #251165
  • Pipeline finished with Success
    3 months ago
    Total: 343s
    #251354
  • Pipeline finished with Failed
    3 months ago
    Total: 253s
    #251440
  • Pipeline finished with Failed
    3 months ago
    Total: 274s
    #251446
  • Pipeline finished with Success
    3 months ago
    Total: 281s
    #251476
  • Pipeline finished with Success
    3 months ago
    Total: 278s
    #251504
  • Pipeline finished with Skipped
    3 months ago
    #251550
  • Pipeline finished with Failed
    3 months ago
    Total: 205s
    #252706
  • Pipeline finished with Success
    3 months ago
    Total: 227s
    #252709
  • Pipeline finished with Failed
    3 months ago
    Total: 767s
    #253242
  • Pipeline finished with Failed
    3 months ago
    Total: 725s
    #253566
  • Pipeline finished with Failed
    3 months ago
    Total: 781s
    #253601
  • Pipeline finished with Failed
    3 months ago
    Total: 435s
    #253637
  • Pipeline finished with Failed
    3 months ago
    Total: 324s
    #253787
  • Pipeline finished with Failed
    3 months ago
    Total: 310s
    #253832
  • Pipeline finished with Failed
    3 months ago
    Total: 365s
    #253833
  • Pipeline finished with Failed
    3 months ago
    Total: 380s
    #253841
  • Pipeline finished with Success
    3 months ago
    Total: 329s
    #253845
  • Pipeline finished with Failed
    about 1 month ago
    Total: 235s
    #305171
  • Pipeline finished with Success
    about 1 month ago
    Total: 250s
    #305207
  • Pipeline finished with Skipped
    about 1 month ago
    #305219
  • Pipeline finished with Success
    about 1 month ago
    Total: 197s
    #306195
  • Pipeline finished with Skipped
    about 1 month ago
    #306266
  • Pipeline finished with Success
    about 1 month ago
    Total: 535s
    #307826
  • Pipeline finished with Failed
    14 days ago
    Total: 424s
    #326782
  • Pipeline finished with Failed
    14 days ago
    Total: 882s
    #326789
  • Pipeline finished with Failed
    14 days ago
    Total: 596s
    #326806
  • Pipeline finished with Success
    14 days ago
    Total: 593s
    #326820
  • Pipeline finished with Skipped
    14 days ago
    #326838
  • Pipeline finished with Failed
    3 days ago
    Total: 3688s
    #336992
  • Pipeline finished with Failed
    2 days ago
    Total: 311s
    #337811
  • Pipeline finished with Failed
    2 days ago
    Total: 157s
    #337851
  • Pipeline finished with Failed
    2 days ago
    Total: 155s
    #337867
  • Pipeline finished with Success
    1 day ago
    Total: 176s
    #338611
  • Pipeline finished with Skipped
    1 day ago
    #338617
  • Pipeline finished with Failed
    about 8 hours ago
    Total: 184s
    #339904
Production build 0.71.5 2024