Problem

This issue deals with the following error:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "view.scheduler_scheduled_content.overview" does not exist.
in Drupal\Core\Routing\RouteProvider->getRouteByName()
 (line 209 of core/lib/Drupal/Core/Routing/RouteProvider.php). 

For the discussion on this, start reading at comment #12


Original

while upgrading drupal/scheduler (1.3.0 => 1.4.0)

[webXXXX@s32:~/www/webXXXX.XXX.XX] $ drush updatedb
 ----------- ----------- --------------- -------------------------------------- 
  Module      Update ID   Type            Description                           
 ----------- ----------- --------------- -------------------------------------- 
  scheduler   8102        hook_update_n   Update view - Move 'Scheduled' tab    
                                          to be a local task under 'Content'.   
 ----------- ----------- --------------- -------------------------------------- 

>  [notice] Update started: scheduler_update_8102
>  [notice] Update completed: scheduler_update_8102
>  [notice] Contact Us elements are not valid. yaml_parse(): scanning error encountered during parsing: found unexpected end of stream (line 21, column 1), context while scanning a quoted scalar (line 20, column 21)
>  [notice] Options likert_quality do not exist.
>  [notice] Options relationship do not exist.
>  [notice] Options likert_quality do not exist.
>  [notice] Options likert_quality do not exist.

Nachricht	Symfony\Component\Routing\Exception\RouteNotFoundException: Route "view.scheduler_scheduled_content.overview" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (Zeile 208 in /home/webXXXX@s32:~/www/webXXXX.XXX.XX/core/lib/Drupal/Core/Routing/RouteProvider.php).

No idea what this means.
But I can't access my content anymore in the backend.

The website encountered an unexpected error. Please try again later.

Any idea ??

Issue fork scheduler-3224340

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

lomale@bluewin.ch created an issue. See original summary.

sseto’s picture

I also have something similar. This is my error:

> [notice] Update started: scheduler_update_8102
> [notice] The "Scheduled" tab is now a "Scheduled content" sub-task under the "Content" tab
> [notice] Update completed: scheduler_update_8102

In ProcessBase.php line 188:

Unable to decode output into JSON: Syntax error

{
"0": {
"scheduler": {
"8102": {
"results": {
"query": "The "Scheduled" tab is now a "Scheduled content" sub-task under the "Content" tab",
"success": true
},
"type": "update"
}
}
},
"drush_batch_process_finished": true
}

Good thing I did this on my local...

Any idea what could be the issue?

lomale@bluewin.ch’s picture

Issue summary: View changes
jonathan1055’s picture

Issue summary: View changes

Hello, Sorry to hear you are having problems.

@lomale
The first two lines of your output are

> [notice] Update started: scheduler_update_8102
> [notice] Update completed: scheduler_update_8102

That is the end of the scheduler update. The next lines [notice] Contact Us elements are not valid and Options likert_quality do not exist are nothing to do with Scheduler. There must be something else causing that error.

The second problem you have is RouteNotFoundException: Route "view.scheduler_scheduled_content.overview" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName()
But that route name has not changed from 8.x-1.3. Did you delete the scheduled content view?

@Sseto
Your update function has also completed sucessfully, as it shows
[notice] Update completed: scheduler_update_8102
The next part seems to be a problem in how the output of the message is displayed. The parse error could be related to the double quotes in the message text "query": "The "Scheduled" tab is now a "Scheduled content" sub-task under the "Content"

The file is vendor/consolidation/site-process/src/ProcessBase.php, the function is getOutputAsJson() and line 188 throws that exception when the json_decode() failed. This works fine in drush and and when running the update via UI on a site update.php. How were you running the update? Also what operating system?

sseto’s picture

Hey jonathan1055,

for this:

"query": "The "Scheduled" tab is now a "Scheduled content" sub-task under the "Content"`
It looks like my site is working correctly and it shows that `success: true`. 

Do you think it's safe to ignore?

I didn't get this warning :
RouteNotFoundException: Route "view.scheduler_scheduled_content.overview" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName()
And I never touched schedule content view. It's still active.

Thanks!

jonathan1055’s picture

Do you think it's safe to ignore?

Yes, I think it is safe to ignore. It is just the display of the output from the update function. Looks like you ran it in batch. Was that how you did it?

sseto’s picture

I used drush to update the DB.

Thanks for your help buddy!

jonathan1055’s picture

StatusFileSize
new51.98 KB

That's good. If you see this when you view the scheduled content at admin/content/scheduled, then it has worked. Instead of a separate 'scheduled' tab, you should see 'overview' and 'scheduled content' sub-task links.
scheduled content sub-task

lomale@bluewin.ch’s picture

StatusFileSize
new166.69 KB

Hi, I'm back

so I can tell

But that route name has not changed from 8.x-1.3. Did you delete the scheduled content view?

No I have not deleted this view.

Bildschirmfoto 2021-07-22 um 22.05.03

But still have the problem that the site crashes when I want to access content.

By now I believe that it is because I hadn't entered any schedule information in the nodes.
Second I found out, that in some nodes I have two event contents there is no possibility to enter scheduled data.

on this site. I deleted the Schedule Module.

My System
Drupal-Version 8.9.16 - 8.9.17

PHP 7.4.16

MySQL-Version: 10.3-MariaDB

jonathan1055’s picture

Category: Bug report » Support request
Priority: Major » Normal

Thanks.

But still have the problem that the site crashes when I want to access content.

This is not the problem you reported in the issue summary.

I believe that it is because I hadn't entered any schedule information in the nodes.

Your screen shot shows that the route must still be working, and the view is working, because you can see the tab.
There are no rows shown in the table because, as you said, you have not entered any scheduler dates.

Second I found out, that in some nodes I have two event contents there is no possibility to enter scheduled data.

Was your site working properly at 8.x-1.3? The changes to 8.x-1.4 should not make that much of a difference.

lomale@bluewin.ch’s picture

Was your site working properly at 8.x-1.3

The Problem is, that I had the module installed, enabled - but never used scheduled nodes

because of upgrading to Drupal 9 I wanted to update to 8.x-1.4

I open a new issues as well

Thanks

emscha’s picture

I also got the same error after updating the module:

The website encountered an unexpected error. Please try again later.

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "view.scheduler_scheduled_content.overview" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 208 of core/lib/Drupal/Core/Routing/RouteProvider.php).

Looking into the error from this particular site, the module was enabled but scheduler.settings config was never created neither views.view.scheduler_scheduled_content.yml exists.

For other sites, the issues were with both links appearing. For those sites, we manually added the missing config code to views.view.scheduler_scheduled_content.yml then importing config after updating module displayed expected UX.

langcode: en
status: true
dependencies:
  config:
    - system.menu.admin
  module:
    - node
    - scheduler
   display_options:
      path: admin/content/scheduled
      menu:
        type: normal
        title: Scheduled
        description: 'Content scheduled for publishing and unpublishing'
        expanded: false
        parent: system.admin_content
        weight: -10
gertlor’s picture

The website encountered an unexpected error. Please try again later.

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "view.scheduler_scheduled_content.overview" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 208 of core/lib/Drupal/Core/Routing/RouteProvider.php).

On one of our websites we got the same problem. The view was never created and the content view (/admin/content) was no longer accessible. Uninstalling and installing the module again created the view and resolved the problem.

jonathan1055’s picture

Hi Gertlor
Thanks for the info. It is odd how some installations never seemed to have that view. Good that you found a simple way to resolve it.

If users cannot or do not want to uninstall and re-install, then you may be able to use the Config Update module to fix it. The 'Configuration Update Reports' sub-module produces reports comparing loaded config with the source files. You can import missing configs, or revert to source.

jonathan1055’s picture

StatusFileSize
new261.56 KB

Here's the report UI, after selecting 'Scheduler' for the report type 'single module'
config report

larowlan’s picture

Alternatively, copy the view from modules/scheduler/config/install into your config-export folder, edit the yml and add a uuid entry, and run config-export

berdir’s picture

The module shouldn't force you to have that view. Modules must not add hardcoded local tasks that depend on configuration.

Instead, this should be done in a local tasks alter hook that checks if the view exists, or alternatively moves the configured local task.

I'll try to provide a patch for this.

jonathan1055’s picture

Thanks Berdir,

The module shouldn't force you to have that view

Yes I agree. In previous versions we did not force it, and the view could be deleted in /admin/structure/views. I think the problem came about due to #3167193: Move "Scheduled" menu tab so it's a task under "Content" where the update hook scheduler_update_8102() tries to modify the view.

berdir’s picture

Title: Upgrading drupal/scheduler (1.3.0 => 1.4.0) » Hardcoded local task dependency on view scheduler_scheduled_content
Version: 8.x-1.4 » 8.x-1.x-dev
Category: Support request » Bug report
Status: Active » Needs review
StatusFileSize
new2.66 KB

Here's a patch that moves both related local tasks into an alter hook. I also moved the "optional" overview tab as eventually, when that core issue happens, it will likely have a different name, and then it's easy to add a second if condition for full back and forwards compatibility for all possible names and eventually (maybe) you can then remove that condition when you require whatever core version moved it to node.module.

Tested on my site that doesn't have the view. I did _not_ yet test on an installation that actually has that view ;)

The update function itself is fine, that already checks if the view exists.

achton’s picture

I have this error as well after upgrading to 1.4.0, when visiting admin/content overview.

Without the patch from #19, I get this error:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "view.scheduler_scheduled_content.overview" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 206 of core/lib/Drupal/Core/Routing/RouteProvider.php).

With the patch from #19, I get a different error:

Drupal\Component\Plugin\Exception\PluginException: The plugin (scheduler.scheduled_content) did not specify an instance class. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 79 of core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).

If I downgrade, the error disappears.

This is on Drupal 9.2 btw.

berdir’s picture

Status: Needs review » Needs work

Ah, I forgot the class, need that in the alter hook. That's why my approach usually is to define a local task on the view and then just change the parent. But I don't want to change the view yet again.

jonathan1055’s picture

Status: Needs work » Needs review
StatusFileSize
new2.83 KB
new1.13 KB

Thanks @berdir for the patch, that's really helpful. And thanks @achton for testing.

Here's an updated patch with 'class' => 'Drupal\Core\Menu\LocalTaskDefault' added for each of the local tasks. With this in place I then got

Notice: Undefined index: options in Drupal\Core\Menu\LocalTaskDefault->getOptions()
(line 108 of /Library/WebServer/Web/drupal89dev/core/lib/Drupal/Core/Menu/LocalTaskDefault.php).

Adding an empty array item 'options' => [] fixed this.

This works for me with manual testing, both with and without the core Content Moderation module enabled, and with and without the scheduer view existing. But we will need test coverage for this (patch #19 passed all tests but was clearly not complete). Also this work will need to go into the 2.x branch first, so that we do not get regression. But for now, one step at a time, here's the patch for you to retest.

mpp’s picture

Adding dependency on core issue so we don't forget this issue when #2172307 is merged.

mpp’s picture

#19 was missing the class from #22 but both #19 & #22 were using hook_local_tasks_alter instead of hook_menu_local_tasks_alter. So I kept getting the error

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "view.scheduler_scheduled_content.overview" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 206 of core/lib/Drupal/Core/Routing/RouteProvider.php).

Fixed this with the proper alter (scheduler_menu_local_tasks_alter) in a MR.

jonathan1055’s picture

Version: 8.x-1.x-dev » 2.x-dev
Assigned: Unassigned » jonathan1055
Status: Needs review » Needs work

I'm going to work on this at 2.x and am thinking about using a dynamic local task deriver class instead of hook_local_tasks_alter() or hook_menu_local_tasks_alter()

jonathan1055’s picture

@Gertlor, @Berdir, @mpp, @achton I have pushed to the 2.x branch. Any chance you could have a quick look and/or test this on your sites which do not have the views or where they are disabled. This all works fine for me locally. I can disable any of the three views (scheduled content, scheduled media, scheduled products) and I do not get the "route does not exist" error.

I tried to expand the test coverage of this, but could not make the test fail when the view is disabled. I could not get the "route does not exist" error. I tried running the functional tests using Bartik as the theme not Stark, but the local tasks are still not rendered. Maybe this is a candidate for a Kernel test? (of which Scheduler does not have any yet). I would like to have a test that uses the routes and that will fail with the existing hard-coded local tasks when the views do not exist or are disabled. Then we can prove that the new dynamic local tasks fix the problem.

jonathan1055’s picture

Issue summary: View changes
Status: Needs work » Needs review

I think the 2.x MR 21 is ready. If anyone else could review and/or test it that would be appreciated. I added checks on the status of the view and the existence of the 'overview' display (thanks to @berdir for that on the earlier 8.x-1.x patch)

matroskeen’s picture

Using the recent version of the merge request fixes the problem for our project, where we just disabled the "Scheduled Media" view (we do not use Scheduler for Media). I like the approach and it's great to see a test coverage. Thank you!

joshua1234511’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new3.2 KB
new2.97 KB
new62.97 KB

Test the latest MR 21 using the patch.
Works Correctly.
Attached screenshots.

jonathan1055’s picture

Hi joshua1234511,
Thanks for testing and pleased to hear it works for you.
However I am not sure exactly what you intended with the patch? The code changes are already made in the MR branch. Your patch is a copy of patch #22 which is for the 8.x-1.x branch of Scheduler. But your screen shot shows that you are using 2.0.0-alpha1 and you have sucessfully used MR 21 (which is correctly for the 2.x branch).
When the work on 2.x has been completed and committed I will also make the equivalent fix on the 8.x-1.x branch.

I do have a little more work to do on the 2.x branch, as I want to remove the hard-coded additions in .routing.yml and .links.task.yml. That will be coming soon.

@Matroskeen - thanks for testing too.

jonathan1055’s picture

Merged MR21 into the 2.x branch.

  • jonathan1055 committed 7ccdaae on 2.x
    Issue #3224340 by jonathan1055, mpp, Berdir, lomale@bluewin.ch, Sseto,...

  • jonathan1055 committed b8cf9be on 2.x
    Issue #3224340 by jonathan1055: Extend testViewScheduledContentOverview...
jonathan1055’s picture

Version: 2.x-dev » 8.x-1.x-dev

The correct hook to use (in 8.x-1.x) is definitely scheduler_local_tasks_alter not scheduler_menu_local_tasks_alter. The initial patch in #19 was correct, but the function comment header had the wrong name.

  • jonathan1055 committed ddb7630 on 8.x-1.x authored by mpp
    Issue #3224340 by jonathan1055, Berdir: Hardcoded local task dependency...
jonathan1055’s picture

Assigned: jonathan1055 » Unassigned
Status: Reviewed & tested by the community » Fixed

Committed to 2.x and 8.x-1.x
Thanks everyone.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.