Problem/Motivation

When trying to install 3.0.0-alpha6 with composer, all installs, but when I try to rebuild the cache, I get the error " You have requested a non-existent service "openid_connect.openid_connect"."

Steps to reproduce

  1. Install Drupal 10.5.1
  2. Using PHP 8.3.19, Drush 13.6.0
  3. Install openid_connect - composer require 'drupal/openid_connect:^3.0@alpha'
  4. run drush cash refresh - drush cr

This results in the following error,

In ContainerBuilder.php line 993:
                                                                              
  You have requested a non-existent service "openid_connect.openid_connect".  

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

a.crowe_drupal created an issue. See original summary.

pfrilling’s picture

Status: Active » Needs review
Related issues: +#3462532: Create and utilise autowiring aliases for OpenID Connect

Thanks for the report @a.crowe_drupal. Can you apply the patch from MR #144? I believe this is a duplicate of #3462532.

a.crowe_drupal’s picture

Many thanks.

I have installed that patch, and I how get the following error,

In CheckExceptionOnInvalidReferenceBehaviorPass.php line 119:
                                                                                                                  
  The service "openid_connect.openid_connect" has a dependency on a non-existent service "externalauth.authmap".  

Thanks again.

Andy.

a.crowe_drupal’s picture

Actually. If I install the patch and do a

drush cr

Then I get the above.

But if I do a

drush updatedb

first, and then the

drush cr

Then I no longer get the error. However, when I go to the site, I get the

Site under maintenance

message.

If I take it out of maintenance mode with drush, then the main page shows, but when I try to log in I get the following error on the screen

The website encountered an unexpected error. Try again later.,

And in the drupal logs,

 41576832   28/Jul 09:11   php       Error      TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 123 of /var/www/d11dev.opengroup.org/web/modules/contrib/openid_connect/src/OpenIDConne  
  41576831   28/Jul 09:11   php       Warning    Warning: Undefined array key "scopes" in Drupal\openid_connect\Plugin\OpenIDConnectClient\OpenIDConnectGenericClient->getClientScopes() (line 147 of /var/www/d11dev.opengroup.org/web/modul  
  41576830   28/Jul 09:11   php       Error      TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 123 of /var/www/d11dev.opengroup.org/web/modules/contrib/openid_connect/src/OpenIDConne  
jérôme dehorter’s picture

Hi,

After update 1.4 to 3.0.0-alpha6 I got the same error :

Error Output:                                                                                        
  ================                                                                                     
                                                                                                       
  In ContainerBuilder.php line 992:                                                                    
                                                                                                       
    You have requested a non-existent service "openid_connect.openid_connect".

D10.3.14
Drush 12
Exteralauth enabled

pfrilling’s picture

@jérôme dehorter... Do you get the same error if you upgrade from 1.4 to the 3.x-dev version?

jérôme dehorter’s picture

Hi @pfrilling,
Yes, I upgrade from 1.4.0 to 3.0.0@alpha6.

To avoid this problem, you need to perform a two-step update:
1 - Uninstall the module and update the configuration.
2 - Deploy to update the database.
3 - Export the database and use it for the following steps.
3 - Delete the module in version 1.4.0
4 - Install version 3.0.0@alpha6
5 - Enable Externalauth and OpenID.
6 - Save the configuration changes.
7 - Deploy a second time.

pfrilling’s picture

Are you able to try to upgrade from 1.4 to 3.x-dev and report if the same steps are required when upgrading to 3.0.0@alpha6? The latest development version has the fix for the non-existent service included.

jérôme dehorter’s picture

Hi @pfrilling,
Yes, I upgrade from 1.4.0 to 3.x-dev.
I'm going to install the latest patch on version 3.0.0-alpha6 to test if it works.
A new working version is required for this to be deployed to production.

jérôme dehorter’s picture

Hi,
I tried reverting to the latest patch, but it didn't work.

Installation is possible with the development version. On my local machine, I have no issues, but on our AWS environments, I have the following problem:
The service "openid_connect.openid_connect" has a dependency on a non-existent service "externalauth.authmap".

jérôme dehorter’s picture

Hi,
I tried to install commit 3.x-dev#6052cff18ea87ee3e801cdc2546739b99e198f31 and it's the same, good on local but not on AWS.

nicocin’s picture

Running into the same problem when upgrading from 1.4 to 3alpha6 :

You have requested a non-existent service "openid_connect.openid_connect".

Dev version does not solve the problem.

Edit : 3.0.0-alpha5 DOES SOLVE the problem.

jérôme dehorter’s picture

@nicocin,
Thanks for the tips, 3.0.0-alph5 solve my problem.

pfrilling’s picture

Thanks for the reports. Just to confirm...

  • Upgrading from 1.4 to 3.0.0-alpha5 works.
  • Upgrading from 1.4 to 3.0.0-alpha6 (or greater) does _not_ work.

Am I understanding that correctly?

---

Once you are on 3.0.0-alpha5, does the upgrade to 3.0.0-alpha6 work?

steinmb’s picture

Perhaps when testing a code change we should recommend using drush deploy -v to make user testing more predictable? Here is a link to the order it run in https://www.drush.org/13.x/deploycommand

jérôme dehorter’s picture

Hi @pfrilling,
Yes, that's right, upgrading from 1.4 to 3.0.0-alpha6

phjou’s picture

I confirm no issues with alpha5, alpha6 on the other hand creates that issue

steinmb’s picture

goz’s picture

I have the same issue. I am on Drupal 10.5.x, currently use openid_connect 1.4, and want to update to 3.0.0-alpha6. I have custom services which use openid_connect.
So currently, externalauth module is not enabled and authmap table does not exist.

When i try drush updb, i have the error : You have requested a non-existent service "openid_connect.openid_connect".

Main difference between 3.0.0-alpha5 and 3.0.0-alpha6 is autowiring.

Finally found a way altering the service provider to not remove openid_connect service if externalauth module is not enabled yet, but remove arguments so externalauth is not called anymore during bootstrap if it does not exist.

class OpenidConnectServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    // This service was introduced as a new dependency in version 2.0alpha3.
    try {
      $container->getDefinition('externalauth.authmap');
    }
    // If the service is not available, remove its dependent services.
    catch (ServiceNotFoundException $exception) {
      // Requires 'externalauth.authmap'.
      $openid_connect = $container->getDefinition('openid_connect.openid_connect');
      $openid_connect->replaceArgument('$authmap', NULL);
      $openid_connect->replaceArgument('$external_auth', NULL);
    }
  }

}

goz’s picture

MR177 is only here to be able to patch 3.0.0-alpha06

ccrosaz’s picture

MR177 works perfectly on `3.0.0-alpha6` version on production servers.

I was wondering if the patch was only necessary during the migration process?

solideogloria’s picture

I was wondering if the patch was only necessary during the migration process?

Yes. After you're up-to-date, you shouldn't need it.

pfrilling’s picture

I updated MR 176 to include some deprecation messaging for removal at a later date and plan to merge it to ensure the 1.x upgrade path succeeds without having to patch. If I can get a second review on those changes, I'll get it merged in.

steinmb’s picture

Version: 3.0.0-alpha6 » 3.x-dev