Drupal\sdc\Exception\InvalidComponentException: [props.properties] Array value found, but an object is required

Created on 16 August 2023, over 1 year ago
Updated 30 November 2023, about 1 year ago

Problem/Motivation

On fresh installation of Drupal 10.1, after settings prototype theme as default, home is WSOD, in log following error is shown

Drupal\sdc\Exception\InvalidComponentException: [props.properties] Array value found, but an object is required in Drupal\sdc\Component\ComponentValidator->validateDefinition() (line 119 of /app/web/core/modules/sdc/src/Component/ComponentValidator.php).
🐛 Bug report
Status

Fixed

Version

5.0

Component

Code

Created by

🇮🇳India Sharique

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

Comments & Activities

  • Issue created by @Sharique
  • Status changed to Postponed: needs info over 1 year ago
  • 🇺🇸United States jldust

    Can you confirm that you enabled the three required modules for Prototype prior to making it the default theme:

    • SDC in Drupal Core
    • Twig Field Value
    • Twig Tweak
  • Status changed to Active over 1 year ago
  • 🇮🇳India Sharique

    Yes, all 3 modules and stable9 theme is enabled.

  • Status changed to Closed: works as designed over 1 year ago
  • 🇺🇸United States jldust

    In order to replicate the issue I did a complete fresh install of Drupal 10.1.2, using PHP 8.2 with Mariadb 10.6, installed all 3 required modules, and added Prototype via composer. After that I navigated to create a theme using the php generator and then activated that theme. The page loaded to a WOD that was cleared with a drush cr.

    I tested numerous different configurations with only Prototype 5.1.1-alpha1 and was unable to ever get it to WOD, it was only after creating a theme via the generator did I encounter an issue. There is a missing directory for the generator I noticed but that is independent of this issue. The WOD was cleared for me after clearing cache and never returned.

  • 🇮🇳India Sharique

    Thanks for checking, I'm still getting WSOD, not what exactly the reason behind this, there is no other SDC components mentioned in code base.

  • 🇺🇸United States asherry

    I ran into this myself. In debugging it's breaking on the prototype components with an empty props.properties definitions. All the component.yml files with:

    props:
      type: object
      properties: {}
    

    ... are getting encoded as an empty array during validation.

    While it's probably a weird issue in encoding, it's worth addressing in prototype as component.yml files only require a name. It's really not worth keeping an empty properties definition.

    I included a patch that also fixes a property that was incorrectly indented in the menu component.

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • 🇮🇳India Sharique

    Thanks asherry for the patch, now I'm getting this error,

    Drupal\sdc\Exception\InvalidComponentException: [items] NULL value found, but an array or an object is required in Drupal\sdc\Component\ComponentValidator->validateProps() (line 201 of /app/web/core/modules/sdc/src/Component/ComponentValidator.php).

    I tried experimenting with pager component, but not able to solve the issue yet.
    BTW I was testing with 5.1.1-alpha2

  • Assigned to jldust
  • Status changed to Postponed over 1 year ago
  • 🇺🇸United States jldust

    After digging into this more I've discovered that this is actually an issue within SDC validation, there is an open issue here: https://www.drupal.org/project/drupal/issues/3385283 🐛 Components without props throw error Fixed
    I'm marking this as postponed and will be working to solve the core issue. Once that has been addressed I'll come back to this ticket and fix the called out props as needed.

  • 🇺🇸United States asherry

    Thanks @jldust, the patch in #3385283 works for us on 10.1.6.

    I do still see validation issues though, somewhat related. It looks like there is an issue in the current 5.1.x accordion item component. Rather than open up a new ticket I made a quick patch that should fix this, however, we should probably create a new ticket to add a simple kernel or functional test to validate component.yml for prototype.

  • Status changed to Needs review about 1 year ago
  • @jldust opened merge request.
  • Status changed to RTBC about 1 year ago
  • 🇺🇸United States asherry

    Changes for the changes and MR to the 5.x branch. This works for us, marking this as RTBC.

    • jldust committed a347df5d on 5.x
      Issue #3381429 by asherry: Drupal\sdc\Exception\...
  • 🇺🇸United States jldust

    Thanks for reviewing, this will be included in the next tagged release.

  • Status changed to Fixed about 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed about 1 year ago
  • 🇮🇳India Sharique

    I tested latest release of theme, and it is working fine.

Production build 0.71.5 2024