Saving unpublished node breaks feed

Created on 15 December 2023, about 1 year ago
Updated 27 March 2024, 9 months ago

Problem/Motivation

I'm having a strange issue which only affects RSS feed views. We have an RSS feed view for recent news articles (News content type) with a "Published status = Yes filter" (pretty standard). When an unpublished News node is saved, the entire feed goes blank. When a published News node is saved, the entire feed comes back. Any suggestions for debugging are extremely helpful, thanks!

I have since reproduced this issue using a brand new view and the basic page content type.

Steps to reproduce

1. Create a new RSS feed view of basic pages
2. Set the title field to be used as the title and description
3. Save the view.
4. Open the view path and observe a working RSS feed of basic page titles
5. Create a new basic page, uncheck "Published" (make it unpublished), and save it.
6. Open the view path and observe a completely empty RSS feed.
7. Edit the new basic page and check "Published" (publish it) and save it.
8. Open the view path and observe a working RSS feed again.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Closed: cannot reproduce

Version

2.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States joegl

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

Comments & Activities

  • Issue created by @joegl
  • πŸ‡ΊπŸ‡ΈUnited States joegl
  • πŸ‡ΊπŸ‡ΈUnited States joegl

    I'm guessing since this isn't widespread that it's something unique in our stack/setup or a hook we have somewhere.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Does the View include unpublished content?

    Please try the patch from πŸ› RSS output is no longer valid XML Fixed to see if it resolves the problem.

  • πŸ‡ΊπŸ‡ΈUnited States joegl

    The view has a filter to filter out Unpublished content and it does not show Unpublished content from what I can tell. I will try the patch and get back to you. Thanks for your help!

  • πŸ‡ΊπŸ‡ΈUnited States joegl

    Patch unfortunately did not resolve the issue.

  • πŸ‡ΊπŸ‡ΈUnited States joegl

    This doesn't affect the Preview section of the view. It only affects the rendered view. And the saving of a node as unpublished as the trigger is suspicious. I am guessing the issue is occurring when it builds the cache of the rendered view after saving content. I'm not exactly sure of the best way to debug, but if I could get a stack trace of the render pipeline I could see if maybe we have a custom hook or code affecting this.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    How many published nodes are there supposed to be?

  • πŸ‡ΊπŸ‡ΈUnited States joegl

    As many as are available. The amount doesn't seem to matter.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Does the output change if you switch to a core theme instead of the normal site theme?

  • πŸ‡ΊπŸ‡ΈUnited States joegl

    I switched to the Stark theme and was able to still reproduce the issue.

  • πŸ‡ΊπŸ‡ΈUnited States joegl

    I did some debugging of the views-view-rss.html.twig

    {{ dpm(items) }}

    I returned NULL for the items when I saved the unpublished node.

    So something is breaking the rendered items when I save an unpublished node.

    Also, after I saved an unpublished node, the view breaks. When I rebuild the cache either through UI or a drush cr, the view is still not working. However, if I re-save the view and try to load it, it works.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Are you able to reproduce the problem with a bare install of D9 or D10, without any extra contrib or custom modules?

  • πŸ‡ΊπŸ‡ΈUnited States joegl

    That's what I plan to do next. Probably won't get to it until January but I will report back

  • πŸ‡ΊπŸ‡ΈUnited States joegl

    I finally got around to testing this on a vanilla drupal install using drupal/recommended-project and was not able to reproduce this

  • πŸ‡ΊπŸ‡ΈUnited States joegl

    I've created views of different types and this only happens with feeds created with `views_rss`. I created an XML feed with `views_data_export` and it did not have this problem. I also created an XML Feed with REST Export and it did not suffer from this issue. Even though I couldn't reproduce it on a vanilla drupal install, there appears to be something with this module specifically that causes this problem. Unfortunately the aforementioned modules don't allow for the creation of a "true" RSS Feed. We may end up coming up with an in-house solution to generate the feed but it would be nice to figure out what's going on here.

    FWIW, I've also struggled a lot trying to debug the code in this module with `dpm` and `var_dump`. I've never been able to get any output from either of those in any part of the code for this module.

  • πŸ‡ΊπŸ‡ΈUnited States joegl

    Well this is interesting.

    We were not using the views_rss module for our feed. I wasn't aware the RSS feed in views was part of Drupal core, which appears to be what we're using. That would explain the dpm/var_dump thing. However, once I uninstalled the views_rss module from the site, the problem completely disappeared. I'm going to run a few more tests to confirm, otherwise this is probably resolved.

  • Status changed to Closed: cannot reproduce 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States joegl

    I'm happy to closet his now, just not sure what closed status is most applicable here. I'm going to pick "cannot reproduce".

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Thanks for letting us know.

    If you end up spotting the source of the bug I'd be happy to look more.

Production build 0.71.5 2024