Lupus Decoupled User Form is incompatible with OpenId Connect

Created on 20 September 2024, 2 months ago

Problem/Motivation

If OpenId Connect is enabled it is breaking the Lupus Decoupled User Form api on <api-prefix>/user/login, because it tries to render the form and lupus decoupled form controller is missing the render context.

The website encountered an unexpected error. Try again later.<br><br><em class="placeholder">LogicException</em>: Render context is empty, because render() was called outside of a renderRoot() or renderPlain() call. Use renderPlain()/renderRoot() or #lazy_builder/#pre_render instead. in <em class="placeholder">Drupal\Core\Render\Renderer-&gt;doRender()</em> (line <em class="placeholder">295</em> of <em class="placeholder">core/lib/Drupal/Core/Render/Renderer.php</em>). <pre class="backtrace">Drupal\Core\Render\Renderer-&gt;render(Array) (Line: 192)
openid_connect_form_user_login_form_alter(Array, Object, &#039;user_login_form&#039;) (Line: 545)
Drupal\Core\Extension\ModuleHandler-&gt;alter(&#039;form&#039;, Array, Object, &#039;user_login_form&#039;) (Line: 841)
Drupal\Core\Form\FormBuilder-&gt;prepareForm(&#039;user_login_form&#039;, Array, Object) (Line: 244)
Drupal\autosave_form\Form\AutosaveFormBuilder-&gt;prepareForm(&#039;user_login_form&#039;, Array, Object) (Line: 284)
Drupal\Core\Form\FormBuilder-&gt;buildForm(Object, Object) (Line: 97)
Drupal\autosave_form\Form\AutosaveFormBuilder-&gt;buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController-&gt;getContentResult(Object, Object) (Line: 22)
Drupal\lupus_decoupled_form\Controller\CustomElementsFormController-&gt;getContentResult(Object, Object) (Line: 181)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 100)
Drupal\ldp_cp_api\LdpCpApiLanguageRequestMiddleware-&gt;handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength-&gt;handle(Object, 1, 1) (Line: 104)
Drupal\lupus_decoupled_ce_api\BackendApiRequest-&gt;handle(Object, 1, 1) (Line: 191)
Drupal\page_cache\StackMiddleware\PageCache-&gt;fetch(Object, 1, 1) (Line: 128)
Drupal\page_cache\StackMiddleware\PageCache-&gt;lookup(Object, 1, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 85)
Drupal\ldp_cdn\FixedBaseUrlMiddleware-&gt;handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors-&gt;handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState-&gt;handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)
</pre>

Steps to reproduce

Have OpenId Connect enabled and configured, then visit the api login url.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇸🇮Slovenia useernamee Ljubljana

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

Comments & Activities

  • Issue created by @useernamee
  • 🇦🇹Austria fago Vienna

    I was thinking that instead of implementing our own controller, we might be able to wrap pre-existing controllers. That will simpify adding new forms and might fix this. For that we need to create a service with container injected though, so we can invoke pre-existing controllers as needed.

Production build 0.71.5 2024