createProxyHeadersArray(): Argument #1 ($headers_string) must be of type string

Created on 26 June 2024, 6 months ago
Updated 16 September 2024, 3 months ago

Problem/Motivation

All images return the following error:

TypeError: Drupal\stage_file_proxy\EventSubscriber\StageFileProxySubscriber::createProxyHeadersArray(): Argument #1 ($headers_string) must be of type string, null given, called in [site path]/web/modules/contrib/stage_file_proxy/src/EventSubscriber/StageFileProxySubscriber.php on line 153 in Drupal\stage_file_proxy\EventSubscriber\StageFileProxySubscriber->createProxyHeadersArray() (line 230 of modules/contrib/stage_file_proxy/src/EventSubscriber/StageFileProxySubscriber.php).
Drupal\stage_file_proxy\EventSubscriber\StageFileProxySubscriber->checkFileOrigin()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 157)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

Updated from 2.1.4 to 3a1 on Drupal 10.2.7, list media in content

๐Ÿ› Bug report
Status

Postponed: needs info

Version

3.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States naidim

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

Merge Requests

Comments & Activities

  • Issue created by @naidim
  • Assigned to abhishek_virasat
  • Merge request !74fix the issue โ†’ (Closed) created by abhishek_virasat
  • Issue was unassigned.
  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia abhishek_virasat

    @naidim, I have fixed the issue and created MR. please review it once.

  • Pipeline finished with Success
    6 months ago
    Total: 145s
    #209207
  • Status changed to Needs work 6 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Some research needs to be done. But just an empty check doesnโ€™t count as it could be masking a larger issue

  • Status changed to Postponed: needs info 6 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Not able to reproduce could additional info be provided?

    @abhishek_gupta1 to receive credit need to be able to reproduce and show it's an issue.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom sp3boy

    FWIW I hit this problem after updating from 2.1 to 3.0@alpha. As far as I can see the stage_file_proxy_update_8003() did not get to add the proxy_headers into the config. However I have not reproduced this in isolation, I am updating code from 10.1 to 10.3 and hitting numerous issues.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom sp3boy

    Update on my previous post: in my case, although I was not seeing any output from Drush that the 8003 update hook has run, it appears to be doing so. The cause of the code error is more likely that my site has a copy of the stage_file_proxy.yml in config/development, the contents of which override anything else in a development context. Ensuring the additional settings are in that copy of the file eliminated my problem.

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

    I can confirm that this issue exists and is blocking updating to 3.1.0 (2024-Jul-21).
    This is troublesome because my "Available Updates" reports in relation to my currently
    installed version of Stage File Proxy 2.1.4:
    Release not supported: Your currently installed release is now unsupported, and is no longer available for download. Uninstalling everything included in this release or upgrading is strongly recommended!
    This implies I must update but I'm blocked because of this issue.

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

    Followup question is the proposed fix I see here (see url below) considered a suitable patch
    or is work going on to do a more complete fix?
    https://git.drupalcode.org/project/stage_file_proxy/-/merge_requests/74/...

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

    Thank you, @sp3boy

    We're using config_split and while everything looked good on our 'devel' environments, I ran into this error on our 'staging' environment.

    proxy_headers: '' had made it into our config/devel/stage_file_proxy.settings.yml file, but not into our config/staging/stage_file_proxy.settings.yml file. Adding it fixed the problem!

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

    We ran into the same error in our 'local' config split and when I applied the same fix
    that @sp3boy used it works. I do think that *either* the fix in #1 should be added and/or
    the hook fixed so it updates the appropriate stage_file_proxy.settings.yml files in
    config splits. If this cannot be fixed soon, I urge that the previous version of this
    module Stage File Proxy 2.1.4 be modified to stop reporting this following way:
    "Release not supported: Your currently installed release is now unsupported, and is no longer available for download. Uninstalling everything included in this release or upgrading is strongly recommended!"
    At least until this issue is fixed.

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia Feng-Shui

    Same issue as will_frank, we were missing proxy_headers and excluded_extensions from our settings file.

  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine Anna D

    Faced with same issue after updating stage_file_proxy to v3.1.
    Using config_split. Thanks to all comments issue was fixed with adding proxy_headers: '' to all
    config/*/stage_file_proxy.settings.yml

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia marc.groth

    Just wanted to add a 'me too' on stage_file_proxy 3.0.0-alpha2. Adding proxy_headers: '' to the config in the relevant config split folder fixed the issue for me

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany tobiasb Berlin

    Had the same.

    I would say lets close the MR and issue with status Closed: works as designed.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave
Production build 0.71.5 2024