Error on config form route after fresh installation

Created on 29 January 2024, 10 months ago

Problem/Motivation

Hello!

I was testing version 8.x-1.x-dev with a fresh Drupal 10 installation on PHP 8.2.5/8.1.18 and ran into the following error when visiting the configuration form route (/admin/config/people/alb_auth);

The website encountered an unexpected error. Try again later.

TypeError: Jose\Component\Signature\Serializer\CompactSerializer::unserialize(): Argument #1 ($input) must be of type string, null given, called in /app/docroot/modules/contrib/alb_auth/src/Claims/ALBClaimsExtractor.php on line 66 in Jose\Component\Signature\Serializer\CompactSerializer->unserialize() (line 56 of /app/vendor/web-token/jwt-framework/src/Component/Signature/Serializer/CompactSerializer.php).
Drupal\alb_auth\Claims\ALBClaimsExtractor->getClaimsFromToken(NULL) (Line: 47)
Drupal\alb_auth\Claims\ALBClaimsExtractor->getClaimsFromRequest(Object) (Line: 95)
Drupal\alb_auth\Form\ConfigurationForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('alb_auth_admin_settings', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

It appears that if the following header is missing from the request, X_AMZN_OIDC_DATA, then getClaimsFromToken() returns null, and then this error is thrown.

Steps to reproduce

  1. Set up new Drupal 10 project
  2. Use composer to install alb_auth
  3. Enable the alb_auth
  4. Drush ULI into the site and visit /admin/config/people/alb_auth

Proposed resolution

It would be a better experience if this had a graceful fallback, and more information on how to properly set things up for usage.

Remaining tasks

  1. Adjust code to fallback to a value that doesn't error
  2. Update readme to describe in more detail what is happening, for example referencing this page.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dan612 Portland, Maine

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

Comments & Activities

Production build 0.71.5 2024