Error: Call to a member function id() on bool in Drupal\yaml_content\Plugin\yaml_content\process\File->process()

Created on 14 March 2023, over 1 year ago
Updated 26 July 2023, over 1 year ago

Process File failed on row 56: $field_data['target_id'] = $file->id();

The basic problem is in row 53 where $file = file_save_data($output, $destination . $filename, FileSystemInterface::EXISTS_REPLACE); is used. In our configuration, we are using an S3 bucket, but the credentials can expire and if that happens, file_save_data fails and returns a boolean.

I suggest using an if statement before line 56 to check if $file is already a FileInterface. In my point of view, it's better not to upload that file than to fully fail the content import.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡ΏCzech Republic siva01

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

Comments & Activities

Production build 0.71.5 2024