500 Internal Server Error

Created on 10 February 2021, over 3 years ago
Updated 11 March 2024, 4 months ago

Problem/Motivation

I get a "500 Internal Server Error" when I try to edit oder add a node, which has a Paragraph field.

When I remove the field from "Manage form display", the error disappears - (but I cannot edit the paragraph fields).

Steps to reproduce

I am not sure, when exactly the error occurs, but I think that's way to reproduce:

  • create a new paragraph and add it to a content type
  • (edit some content)
  • add a new field to the paragraph

The error appears on add new content too.

I have no idea how to debug it?

(No errors in Drupal-Log-Files).
(Tried different PHP-Versions 7.1,7.2,7.3.,7.4)

๐Ÿ› Bug report
Status

Active

Version

1.12

Component

Code

Created by

๐Ÿ‡ฉ๐Ÿ‡ชGermany Tilo Schumann

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States DamienMcKenna NH, USA

    Has anyone confirmed for certain that the problem is only from http.response.debug_cacheability_headers:true and that the other developer settings aren't also interfering? If so, it might be possible for Entity Reference Revision or Paragraphs to work around this setting, or at least display a warning that it's set.

  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands zebda

    Same problem here, unfortunately removing or changing the code doesn't work for me.
    http.response.debug_cacheability_headers: true
    Any suggestions on how to solve this?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States DamienMcKenna NH, USA

    FWIW once you set http.response.debug_cacheability_headers to "false", or remove the line from all services.yml files loaded on the site, you have to rebuild the caches in order for Drupal to pick up the changed value.

  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands zebda

    Thanks for the reply, I found out my problem was because of an infinite loop.

    To reproduce:

    • Add one paragraph
    • Add a field to add a nested paragraph
    • On node level add a paragraphs field

    Because there is one paragraph this is added by default and because the paragraph has a nested paragraph it keeps adding paragraphs till a 500 error occurs. So if this is your setup make sure the paragraph is not added by default.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States AaronELBorg

    Has anyone confirmed for certain that the problem is only from http.response.debug_cacheability_headers:true and that the other developer settings aren't also interfering?

    I can confirm that the http.response.debug_cacheability_headers setting is indeed what's causing the issue for me. Never ran into this before today.

    To trigger the issue, I added a boolean field to one paragraph and all was well. However if I added that same field (e.g. reused the field) to another paragraph that appears within a 'field_flexible_content' field (which is a entity_reference_revision field), I got the whitescreen/500 error. Both paragraphs are nested within the same node and both have content, fwiw.

    This is my development.services.yml:

    # Local development services.
    #
    # To activate this feature, follow the instructions at the top of the
    # โ€˜example.settings.local.phpโ€™ file, which sits next to this file.
    parameters:
      http.response.debug_cacheability_headers: false  #<-when this is true i get a whitescreen/500 error on node/edit
      twig.config:
        # Twig debugging:
        #
        # When debugging is enabled:
        # - The markup of each Twig template is surrounded by HTML comments that
        #   contain theming information, such as template file name suggestions.
        # - Note that this debugging markup will cause automated tests that directly
        #   check rendered HTML to fail. When running automated tests, โ€˜debugโ€™
        #   should be set to FALSE.
        # - The dump() function can be used in Twig templates to output information
        #   about template variables.
        # - Twig templates are automatically recompiled whenever the source code
        #   changes (see auto_reload below).
        #
        # For more information about debugging Twig templates, see
        # https://www.drupal.org/node/1906392.
        #
        # Not recommended in production environments
        # @default false
        debug: true
        # Twig auto-reload:
        #
        # Automatically recompile Twig templates whenever the source code changes.
        # If you donโ€™t provide a value for auto_reload, it will be determined
        # based on the value of debug.
        #
        # Not recommended in production environments
        # @default null
        auto_reload: null
        # Twig cache:
        #
        # By default, Twig templates will be compiled and stored in the filesystem
        # to increase performance. Disabling the Twig cache will recompile the
        # templates from source each time they are used. In most cases the
        # auto_reload setting above should be enabled rather than disabling the
        # Twig cache.
        #
        # Not recommended in production environments
        # @default true
        cache: false
    services:
      cache.backend.null:
        class: Drupal\Core\Cache\NullBackendFactory
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States AaronELBorg

    Interesting...

    I had to add that reused field to yet another paragraph (so now 3 paragraphs have that field). Truth be told, I need to add it to at least 4 more.

    After adding it to the 3rd one, the 500 error is back on node/edit regardless of the http.response.debug_cacheability_headers setting (true or false).

Production build 0.69.0 2024