Problem/Motivation

Installing the Navigation module on Drupal 11.0.x branch is throwing the fatal error:

TypeError: Drupal\experience_builder\PropShape\PropShape::resolveSchemaReferences(): Argument #1 ($schema) must be of type array, string given in Drupal\experience_builder\PropShape\PropShape::resolveSchemaReferences() (line 50 of modules/custom/experience_builder/src/PropShape/PropShape.php).

Steps to reproduce

1) Install Drupal from the 11.0.x branch.
2) Go to the extensions page and install the Navigation module.
3) It will throw the fatal error.

Proposed resolution

On debugging, It looked like the issue is related to the component core/modules/navigation/components/toolbar-button/toolbar-button.component.yml

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kunalkursija created an issue. See original summary.

kunalkursija’s picture

Issue summary: View changes
cilefen’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

Does the error occur if you uninstall the custom/experience_builder module that is throwing an exception? Can you provide a stack trace?

I am marking this as needing more steps to reproduce because additional modules are needed for the setup that are not mentioned on the steps.

kunalkursija’s picture

@cilefen - The error does not occur when the experience_builder module is uninstalled. Here is the entire error trace:

TypeError: Drupal\experience_builder\PropShape\PropShape::resolveSchemaReferences(): Argument #1 ($schema) must be of type array, string given in Drupal\experience_builder\PropShape\PropShape::resolveSchemaReferences() (line 50 of modules/custom/experience_builder/src/PropShape/PropShape.php).
array_map() (Line: 62)
Drupal\experience_builder\PropShape\PropShape::resolveSchemaReferences() (Line: 37)
Drupal\experience_builder\PropShape\PropShape->__construct() (Line: 41)
Drupal\experience_builder\PropShape\PropShape::normalize() (Line: 102)
Drupal\experience_builder\PropShape\PropShape::getComponentPropsForMetadata() (Line: 167)
Drupal\experience_builder\Plugin\ComponentPluginManager->propHasStorablePropShape() (Line: 156)
Drupal\experience_builder\Plugin\ComponentPluginManager->componentMeetsRequirements() (Line: 97)
Drupal\experience_builder\Plugin\ComponentPluginManager->setCachedDefinitions() (Line: 214)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 573)
experience_builder_modules_installed()
call_user_func_array() (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 415)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 381)
Drupal\Core\Extension\ModuleInstaller->install() (Line: 83)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install() (Line: 175)
Drupal\system\Form\ModulesListConfirmForm->submitForm()
call_user_func_array() (Line: 105)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 43)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 589)
Drupal\Core\Form\FormBuilder->processForm() (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)
lauriii’s picture

Project: Drupal core » Experience Builder
Version: 11.0.x-dev » 0.x-dev
Component: navigation.module » Page builder
Status: Postponed (maintainer needs more info) » Active
Issue tags: -Needs steps to reproduce

Moving to the Experience Builder queue since this seems like a problem most likely related to it.

lauriii’s picture

This seems related to #3467870: Support `{type: array, …}` prop shapes. I wonder if we should add a new requirement for components; i.e. to not have type: array properties?

This is also pointing another problem; we need a way for components to indicate if the component should be available for Experience Builder. I would not expect anyone to ever want to use the "Toolbar button" component in Experience Builder.

wim leers’s picture

Assigned: Unassigned » lauriii
Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs product manager review

This is also pointing another problem; we need a way for components to indicate if the component should be available for Experience Builder. I would not expect anyone to ever want to use the "Toolbar button" component in Experience Builder.

Emphasis mine.

This is a contradiction with earlier statements you made? 😅

You specifically said that SDCs should not in any way have to be changed. But you did quality that with "changed for use in XB, which specifically is NOT the case here.

So: this is possible. What do you envision the DX for that to be like from a Product POV?

wim leers’s picture

Title: Fatal error on installing the Navigation module » Fatal error on installing the Navigation module: `PropShape::resolveSchemaReferences(): Argument #1 ($schema) must be of type array, string given`
Component: Page builder » Config management
Priority: Normal » Critical
Status: Postponed (maintainer needs more info) » Needs review

This seems related to #3467870: Support `{type: array, …}` prop shapes. I wonder if we should add a new requirement for components; i.e. to not have type: array properties?

No; that can't shouldn't 😅 be the reason: XB literally won't try creating an XB Component config entity when it encounters a prop shape it doesn't know how to support.

The stack trace (THANK YOU, @kunalkursija! 🤩) points to ::resolveSchemaReferences(). I bet this is simply a bug in there, which is a necessary processing step before the decision is made to create an XB Component config entity or not!

I actually ran into this ~2 months ago while working with the folks who were developing https://www.drupal.org/project/demo_design_system for #3454094: Milestone 0.1.0: Experience Builder Demo. Then they moved away from type: array altogether and hence the problem disappeared. Many urgent things happened, and I failed to create a new issue 🙈

MR created with what I think fixes it, @kunalkursija, can you test again? 😊

kunalkursija’s picture

@wim leers - I will test it today & share how it goes.

kunalkursija’s picture

@wim leers - The fatal error did not occur after applying the patch.

Testing Steps Performed:

  • Took fresh clone of the XB module
  • Applied the patch
  • Installed XB.
  • Installed Navigation
  • Installed Navigation Top Bar

The patch looks good. Thanks @wim leers for the quick fix :)

wim leers’s picture

Assigned: lauriii » wim leers
Status: Needs review » Reviewed & tested by the community

A simple hardening for a few LoC IMHO should not have to wait >24 hours. It's already been five days since #9, and >36 hours since #11.

  • wim leers committed 0d2fba8c on 0.x
    Issue #3485820 by wim leers, kunalkursija, lauriii, cilefen: Fatal error...
wim leers’s picture

Component: Config management » Data model
Assigned: wim leers » lauriii
Issue tags: +Needs followup

@lauriii Back to you because #7 still needs to be answered by you, and merits an explicit issue 🙏

wim leers’s picture

@tedbow's comment on the MR is a correct interpretation of what the bugfix is that landed here 👍🤓

It's not a fix specific to the Navigation module's SDCs, it's a generic bugfix, that https://www.drupal.org/project/demo_design_system also ran into!

dunx’s picture

I don't know if this is of any more use or just noise, but I had the same error on enabling XB 0.1.0-alpha1 on Drupal CMS. That Drupal CMS build was based on https://git.drupalcode.org/api/v4/projects/157093/jobs/3432366/artifacts... and I hadn't installed anything else or made any other config changes.

Stack trace slightly different.

The website encountered an unexpected error. Try again later.

TypeError: Drupal\experience_builder\PropShape\PropShape::resolveSchemaReferences(): Argument #1 ($schema) must be of type array, string given in Drupal\experience_builder\PropShape\PropShape::resolveSchemaReferences() (line 49 of modules/contrib/experience_builder/src/PropShape/PropShape.php).
array_map() (Line: 61)
Drupal\experience_builder\PropShape\PropShape::resolveSchemaReferences() (Line: 36)
Drupal\experience_builder\PropShape\PropShape->__construct() (Line: 40)
Drupal\experience_builder\PropShape\PropShape::normalize() (Line: 101)
Drupal\experience_builder\PropShape\PropShape::getComponentPropsForMetadata() (Line: 167)
Drupal\experience_builder\Plugin\ComponentPluginManager->propHasStorablePropShape() (Line: 156)
Drupal\experience_builder\Plugin\ComponentPluginManager->componentMeetsRequirements() (Line: 97)
Drupal\experience_builder\Plugin\ComponentPluginManager->setCachedDefinitions() (Line: 214)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 588)
experience_builder_rebuild()
call_user_func_array() (Line: 355)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 307)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 354)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 446)
drupal_flush_all_caches() (Line: 34)
experience_builder_install() (Line: 748)
Drupal\Core\Extension\ModuleInstaller->invoke() (Line: 368)
Drupal\Core\Extension\ModuleInstaller->install() (Line: 83)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install() (Line: 504)
Drupal\system\Form\ModulesListForm->submitForm()
call_user_func_array() (Line: 105)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() (Line: 43)
Drupal\Core\Form\FormSubmitter->doSubmitForm() (Line: 589)
Drupal\Core\Form\FormBuilder->processForm() (Line: 144)
Drupal\autosave_form\Form\AutosaveFormBuilder->processForm() (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 97)
Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)
dunx’s picture

Site is now dead. Can't drush pmu as getting experience_builder: The <em class="placeholder">Experience Builder</em> field type is used in the following field: node.field_xb_demo. I'll reload from scratch.

wim leers’s picture

@dunx in #16: 0.1.0-alpha1 was just a snapshot in time. It gets zero updates. This bug was fixed in the 0.x branch and will ship only in 0.2.0-alpha1 in a few months — no other releases will happen.

If you want to test XB in its current shape, you must install 0.x-dev 😊

kristen pol’s picture

Hmm... just got this but I'm using 0.x. I'll see if I can figure it out.

UPDATE: Ignore... for some reason, head was detached, just like mine, so all sorted.

dzinkevich’s picture

I had the same issue as @dunx - I followed the composer instructions on the project page:

composer require 'drupal/experience_builder:^0.1@alpha'

Having the same issue with a broken install that I can't revert from.

I know it's in the works but it would be great if this 0.2@alpha could get released soon so others don't have this gotcha.

wim leers’s picture

https://www.drupal.org/project/experience_builder/releases/0.2.0-alpha1 is out. You still need to follow the instructions in CONTRIBUTING.md though. #3510892: Allow XB to be gradually adopted: make XB's viewing (formatter) and editing (`ApiLayoutController::get()`) work with an empty XB field will ease that 👍

I haven't gotten a response to #7 from @lauriii in almost 4 months. I don't want to keep this issue open any longer. I'll ping him one more time and he can then remove the tags when he answers it. 👍

lauriii’s picture

Sorry for dropping the ball here. What I was thinking in #6 was providing a new property for SDCs to opt-out from XB, e.g., hideFromUi: true. This would allow indicating that a specific component never makes sense to be displayed in XB. Because this is opt-out, this doesn't go against the original principle in my mind.

penyaskito’s picture

Issue tags: -Needs followup

Created #3513078: Provide an opt-out for hiding a SDC component from XB for following-up on Lauri's proposal.

Status: Fixed » Closed (fixed)

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