Cron tasks don't work: Could the Domain Access module be the cause? I have an issue with a website running Drupal 8. I cannot seem to get cron working. If I go to the status page and click 'run now' it works. If I try to open the cron settings (/admin/config/system/cron) I get an error. The log reports the following:


  Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "key" for route "system.cron" must match "[^/]++" ("" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 202 of /var/www/exin.com/files/core/lib/Drupal/Core/Routing/UrlGenerator.php). 


I looked up the system.cron path in the core files and found it attached to /cron/{key}, so that is not the settings page. It is the URL I was supposed to use for the cron tasks. Calling that URL (replacing {key} with my token) generates a permission denied error, even if I open it when logged in as administrator. 

I found the key on the status page by looking at the URL of the 'run now' button (/admin/reports/status/run-cron?token=mytoken). Is this the correct token?

I'm running Drupal 8.3.7, which was updated from version 8.3.1, where I had the same issue.

I'm also using the Domain access module and some creative nginx configuration to open different "domains" through a proxy, which (for example) takes users from www.mysite.com/fr/ to fr.mysite.com. This was necessary since the Domain access module could not work with subdirectories. It caused a lot of issues which we managed to resolve, but this one sticks. So I'm not sure it is caused by either this module or the nginx configuration, but I feel it is important information.
The error is coming obviously from these lines of code in the cron settings form, when it tries to build the cron link:

$cron_url = $this-&gt;url('system.cron', ['key' =&gt; $this-&gt;state-&gt;get('system.cron_key')], ['absolute' =&gt; TRUE]);
$form['cron_url'] = [
  '#markup' =&gt; '&lt;p&gt;' . t('To run cron from outside the site, go to &lt;a href=":cron"&gt;@cron&lt;/a&gt;', [':cron' =&gt; $cron_url, '@cron' =&gt; $cron_url]) . '&lt;/p&gt;',
];


So you somehow lost the State variable system.cron_key, which is on your site "" and causes the error. You find this in the database in the table key_value and collection state.

To set a new key you can rerun this code from system_install():

  // Populate the cron key state variable.
  $cron_key = \Drupal\Component\Utility\Crypt::randomBytesBase64(55);
  \Drupal::state()-&gt;set('system.cron_key', $cron_key);