Problem/Motivation

I have a site with domain enabled. However I'm not sure if this would make a difference as the core route service provider would have the same issue.

on enabling the fastly module I get

"domain.route_provider", path: "drush.command.services -> drupal.commands -> domain.route_provider -> cache_tags.inva  
>   lidator -> fastly.cache_tags.invalidator -> fastly.api -> logger.channel.fastly -> logger.factory -> logger.syslog -> router -> router.no_access_checks

Looking at this chain, I think we may have to change what is injected and what is created. (For what it is worth I did this with the logger and then the router was an issue.

I'm on Drupal 9.3

Steps to reproduce

Download and enable fastly

Proposed resolution

Change some services to be taken from the container when needed rather than injected.

I'll probably roll a patch for this as I need it to work.

CommentFileSizeAuthor
#4 remove-injection-3272013-4.patch2.77 KBJeremyFrench

Issue fork fastly-3272013

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

JeremyFrench created an issue. See original summary.

JeremyFrench’s picture

Status: Needs work » Needs review
JeremyFrench’s picture

StatusFileSize
new2.77 KB

Adding patch file. As well as branch. This seems to do the trick.

xsdx’s picture

Not sure what issue is here exactly. Maybe some more information would be helpful.
Tried to download and enable the module and did not get any issues.
Dependency injection in this case is ok and recommended way to go since CacheTagsInvalidator is a class and what you are referring to are methods of that class. In your proposed patch you are basically removing recommended DI and using those injected services as a static calls inside a method which is not static which is a bad practice.

xsdx’s picture

Status: Needs review » Postponed (maintainer needs more info)
vvuksan-fastly’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

As you are on 9.3 please try the 4.0.x branch.

operinko’s picture

I'm seeing the same issue on 4.x branch, on a site running a multisite installation using Domain module.

│ php [2023-11-02T13:05:58.175283+02:00] php.ERROR: Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "domain.route_provider", path: "options_request_listener -> domain.route_provider -> cache_tags │
│ .invalidator -> fastly.cache_tags.invalidator -> fastly.api -> fastly.services.webhook -> router -> router.no_access_checks". in Drupal\Component\DependencyInjection\Container->get() (line 147 of /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Containe │
│ r.php). {"severity_level":3,"exception":"[object] (Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException(code: 0): Circular reference detected for service \"domain.route_provider\", path: \"options_request_listener -> domain.route_provi │
│ der -> cache_tags.invalidator -> fastly.cache_tags.invalidator -> fastly.api -> fastly.services.webhook -> router -> router.no_access_checks\". at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php:147)"} {"referer":"","ip":"[ip_redacted]"," │
│ request_uri":"https://[domain_redacted]/","uid":0,"user":""}                                                                                                                                                                                              │
│ php NOTICE: PHP message: Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: "Circular reference detected for service "domain.route_provider", path: "options_request_listener -> domain.route_provider -> cache_tags. │
│ invalidator -> fastly.cache_tags.invalidator -> fastly.api -> fastly.services.webhook -> router -> router.no_access_checks"." at /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php line 147

The site in question has 3 domains enabled.

operinko’s picture

Version: 8.x-3.0 » 4.0.2
Status: Closed (cannot reproduce) » Needs work
xsdx’s picture

@operinko
This looks like something possibly related to domain module instead of fastly module.
There were at least 2 issues on domain and domain site settings module reported for similar issues:
https://www.drupal.org/project/domain/issues/3005048 and https://www.drupal.org/project/domain_site_settings/issues/2930391
Can you check those if it helps you out ? Tnx

xsdx’s picture

Status: Needs work » Postponed (maintainer needs more info)
hchonov’s picture

Status: Postponed (maintainer needs more info) » Needs review

I am getting a similar error during config import or when I try to uninstall a module with drush pmu, however the domain module is not in the trace here, but eca. So probably this is rather something actually within the fastly module. The proposed patch solves the problem for me.

In Container.php line 149:

  Circular reference detected for service "Drupal\Core\Logger\LoggerChannelFactoryInterface", path: "plugin.cache_clearer -> plugin.manager.block -> logger.channel.defa
  ult -> Drupal\Core\Logger\LoggerChannelFactoryInterface -> logger.filelog -> eca.service.token -> cache_tags.invalidator -> fastly.cache_tags.invalidator -> fastly.ap
  i -> logger.channel.fastly".


Failed to log error: Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "Drupal\Core\Logger\LoggerChannelFactoryInterface", path: "purge.purgers -> purge.logger -> Drupal\Core\Logger\LoggerChannelFactoryInterface -> logger.filelog -> eca.service.token -> cache_tags.invalidator -> fastly.cache_tags.invalidator -> fastly.api -> logger.channel.fastly". in Drupal\Component\DependencyInjection\Container->get() (line 149 of /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php). #0 /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(438): Drupal\Component\DependencyInjection\Container->get()
pameeela’s picture

Just hit another version of this:
Circular reference detected for service "fastly.api", path: "fastly.api -> fastly.services.webhook -> Drupal\menu_link_content\Hook\MenuLinkContentHooks -> plugin.manager.menu.link -> Drupal\Core\Menu\MenuTreeStorageInterface -> cache_tags.invalidator -> fastly.cache_tags.invalidator".

While testing 11.4. This patch solves it for me too.

richo_au’s picture

Have raised this with Fastly via our partner relationship asking that it be merged and released, similar pattern we have performed with other minor updates in the past.