Error when uploading files to a custom block

Created on 14 February 2023, almost 2 years ago
Updated 13 September 2023, about 1 year ago

Problem

In general blob storage is working fine on a Drupal 9.5.3 site, on PHP 8.1.15. We're using Media in core as the UI for managing files.

When uploading an image into a field in a paragraph on a custom block, however, the POST request to upload the file fails with a 500 error, and this is logged:

NOTICE: PHP message: Uncaught PHP Exception InvalidArgumentException: "'blob' can't be NULL or empty." at /var/www/tarion.com/vendor/microsoft/azure-storage-common/src/Common/Internal/Validate.php line 105

Steps to reproduce

- Have a block type with a paragraph field that has an image field
- Structure → Block layout → Add custom block
- Click that block type that has a paragraph field with an image field
- Inside the paragraph, click 'Add media'
- In the Media dialogue box, click 'Browse...' and select an image
- The upload will fail as described above

Proposed resolution

I'm not sure whether this is related to Paragraphs module or Blocks. Also, if Az Blob Storage module is disabled, the uploads to that field work fine.

Workaround: go to Content → Media → Add media and upload the image through there, then instead of uploading the file from the 'Add custom block' screen, it's possible to pick it instead.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇨🇦Canada Liam McDermott

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

Comments & Activities

  • Issue created by @Liam McDermott
  • 🇨🇦Canada geoanders Nova Scotia 🍁

    Most likely due to paragraphs and probably needs more testing when working with it.

    I suspect it's probably the way the file comes in etc.

  • 🇨🇦Canada geoanders Nova Scotia 🍁
  • 🇮🇳India ramalingam07 Tamilnadu, Chennai

    Same error I am also getting while try to upload a video file in Drupal 9.5.9 version.
    This is configured in media file entity, but not working as we expected.

    InvalidArgumentException: 'blob' can't be NULL or empty. in MicrosoftAzure\Storage\Common\Internal\Validate::notNullOrEmpty() (line 105 of C:\xampp\htdocs\atrihub\vendor\microsoft\azure-storage-common\src\Common\Internal\Validate.php).

  • 🇧🇪Belgium mauro_

    I am having the same issue when using the media browser. I can upload images on the media page but not on a page through the media browser modal.

Production build 0.71.5 2024