Required argument "asset" is not set

Hello

Since yesterday I’ve got an error message in the backend of Neos:
"Required argument “asset” is not set. - Check the logs for details"

The output of the log file:

    Exception #1298012500 in line 203 of /Users/adrianhirschi/development/local/neos/AntProduction/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Flow_Mvc_Controller_ActionController.php: Required argument "asset" is not set.

    11 Neos\Flow\Mvc\Controller\AbstractController_Original::mapRequestArgumentsToControllerArguments()
    10 Neos\Flow\Mvc\Controller\ActionController_Original::processRequest(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
    9 Neos\Flow\Mvc\Dispatcher_Original::initiateDispatchLoop(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
    8 Neos\Flow\Mvc\Dispatcher_Original::dispatch(Neos\Flow\Mvc\ActionRequest, Neos\Flow\Mvc\ActionResponse)
    7 call_user_func_array(array|2|, array|2|)
    6 Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy::__call("dispatch", array|2|)
    5 Neos\Flow\Mvc\DispatchComponent_Original::handle(Neos\Flow\Http\Component\ComponentContext)
    4 Neos\Flow\Http\Component\ComponentChain_Original::handle(Neos\Flow\Http\Component\ComponentContext)
    3 Neos\Flow\Http\Component\ComponentChain_Original::handle(Neos\Flow\Http\Component\ComponentContext)
    2 Neos\Flow\Http\RequestHandler::handleRequest()
    1 Neos\Flow\Core\Bootstrap::run()


    HTTP REQUEST:
    127.0.0.1:8081Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:77.0) Gecko/20100101 Firefox/77.0*/*de,en-US;q=0.7,en;q=0.3gzip, deflatehttp://127.0.0.1:8081/neos/content?node=%2Fsites%2Fsite%40user-adrianhirschi%3Blanguage%3Dde21dbb53db95958be3d5c691d18dce6fcmultipart/form-data; boundary=---------------------------91877875918732146853223241372http://127.0.0.1:808125590095keep-aliveNeos_Session=p86RvzutfPQYnRUfBy4bui7y2to7ZD1w

    HTTP RESPONSE:
    200

    PHP PROCESS:
    Inode: 5812068
    PID: 3098
    UID: 501
    GID: 20
    User: adrianhirschi

Before the error appears, I’ve developed the Header and the Footer for the page and everything was working fine. Yesterday I’ve started to build the hero element for the page, that was the first time when the error apperaed.

The .yaml file of the hero:

'AntProduction.Site:Content.Hero':
  superTypes:
    'Neos.Neos:Content': true
  ui:
    label: 'Hero Image'
    icon: crown
    group: hero
    position: 50
    inspector:

      tabs:
        settings:
          label: 'Settings'
          icon: cogs
          position: 100

      groups:
        image:
          tab: settings
          label: 'Image'
          icon: icon-image

  properties:
    heroImage:
      type: Neos\Media\Domain\Model\ImageInterface
      ui:
        label: 'Hero Image'
        reloadIfChanged: true
        inspector:
          group: 'image'

    alternativeText:
      type: string
      ui:
        label: 'Alternative Text'
        inspector:
          group: image

And the .fusion file:

prototype(AntProduction.Site:Content.Hero) < prototype(Neos.Neos:ContentComponent) {
    
    heroImageSrc = Neos.Fusion:Case {
        image {
            condition = ${q(node).property('heroImage') ? true : false}
            renderer = Sitegeist.Kaleidoscope:AssetImageSource {
                asset = ${q(node).property('heroImage')}
            }
        }
        dummyImage {
            condition = ${site.context.inBackend}
            renderer = Sitegeist.Kaleidoscope:DummyImageSource
        }
    }
    alternativeText = ${q(node).property('alternativeText')}
    
    renderer = afx`
        <Sitegeist.Kaleidoscope:Image
            @if.hasSource={props.heroImageSrc}
            class="antproduction-hero"
            alt={props.alternativeText}
            imageSource={props.heroImageSrc}
            srcset="320w, 400w, 600w, 800w, 1000w, 1200w, 1600w"
            sizes="(min-width: 800px) 1000px, (min-width: 480px) 800px, (min-width: 320px) 440px, 100vw"
        />
    `
}

I guess that the error isn’t thrown by the hero, because I’m not able to change any pictures on the page that I was able to change some days ago. Flushing the cache does not work too.
Using Neos.Neos:ImageUri throws the same error as Sitegeist.Kaleidoscope:AssetImageSource that’s why I think the error is thrown somewhere else.
I’ve also checked the part of the PHP file mentioned in the log but wasn’t able to understand the PHP code.

Has someone an idea what to do and how to solve this problem?

I’m looking forward to any kind of help!

Adrian

Can you check your Web Developer Toolbar Network tab while you do this and see which requests happen there? It looks a bit like the actual asset does not even reach the server.

I checked the different tabs in the Firefox Development Environment.

In the Console Tab it outputs me the following error:

Error: <br />
<b>Warning</b>:  POST Content-Length of 25590111 bytes exceeds the limit of 8388608 bytes in <b>Unknown</b> on line <b>0</b><br />
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
    <head>
        <title>500 Internal Server Error</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <style>
        * {
    margin: 0;
    padding: 0;
}

body {
    background-color: #e6e6e6;
    font-family: 'Work Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 13px;
    padding: 20px;
}

pre {
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}

ol > li {
  color: #ffffff;
}

h1, h2, h3 {
  font-weight: normal;
}

.color-muted {
    color: #ffffff;
}

.color-highlight {
    color: #D75200;
}

.color-text-inverted {
    color: #00ADEE;
}

.ExceptionSubject {
    font-size: 18px;
    line-height: 150%;
    margin: 0 0 15px 0;
    color: #00ADEE;
}

.ExceptionBody {
 …

In the Network tab are the following information is shown:

36 Anfragen
10,10 MB / 10,09 MB übertragen
Beendet: 14,05 s
DOMContentLoaded: 2,18 s
load: 2,21 s
Angefragte Adresse:http://127.0.0.1:8081/neos/content/upload-asset
Anfragemethode:POST
Externe Adresse:127.0.0.1:8081
Status-Code:500 Internal Server Error
Version:HTTP/1.1
Referrer Policy:no-referrer-when-downgrade

The request was the following:

-----------------------------74916514017778895853899217279
Content-Disposition: form-data; name="__siteNodeName"

/sites/site@user-adrianhirschi;language=de
-----------------------------74916514017778895853899217279
Content-Disposition: form-data; name="asset[resource]"; filename="chess.png"
Content-Type: image/png

‰PNG


[...]

And that causes this answer:

That leads me to the idea, that the picture might be too big (25.6MB). I tried it with a smaler one that causes the following error message:
Validation failed while trying to call Neos\Neos\Controller\Backend\ContentController->uploadAssetAction().

After flushing the cache the error above was still there. The request was the following:

-----------------------------13414794804236929841151535286
Content-Disposition: form-data; name="__siteNodeName"

/sites/site@user-adrianhirschi;language=de
-----------------------------13414794804236929841151535286
Content-Disposition: form-data; name="asset[resource]"; filename="avatar.png"
Content-Type: image/png

‰PNG


[...]

And it causes this answer:

Validation failed while trying to call Neos\Neos\Controller\Backend\ContentController->uploadAssetAction().

That was a picture with a size of 3.3MB. Once again i tried it with another one (1.4MB) which worked fine.

It seems that I’ve two problems.
The first one is the size of the picture, right?
And what causes the second error about the vallidation?

Your max upload size in php is too low. By default it’s 2MB.

Setting it higher should solve your issues.

Absolutely right.
Increasing the upload_max_filesize in the php.ini file from 2M to 128M solved all issues.

Many thanks for the support.

1 Like

Hey guys,

I’ve been struggling with this issue on multiple websites. Of course, following the solution and setting the upload_max_filesize to something like 8MB or 10MB, but it seems it has no effect whatsoever.

Are there any Neos-specific config files which would override the CLI / Apache2 PHP.ini?

I’ve been searching through the server but couldn’t find anything.

Uploading smaller images (less than 2MB, which was the limit initially set in the PHP.ini-s) works just fine.

Many thanks for your help!

Konrad


N.B.: Running Ubuntu v.22 on Hetzner virtual servers, amongst others for www.brynda.ch or neos.eero.world…

root@at-wpre-neos-1:/var/www/neos.brynda.ch/Web# grep -R "upload_max_filesize" /etc/php/
/etc/php/8.1/cli/php.ini.bkp:upload_max_filesize = 2M
/etc/php/8.1/cli/php.ini:upload_max_filesize = 10M
/etc/php/8.1/apache2/php.ini.bkp:upload_max_filesize = 2M
/etc/php/8.1/apache2/php.ini:upload_max_filesize = 10M
/etc/php/7.4/cli/php.ini.bkp:upload_max_filesize = 2M

SOLUTION

In case anyone has the same problem…

I followed this solution: ubuntu - php.ini unable to change upload_max_filesize - Stack Overflow … to check for errors in the php.ini file, and indeed there were two lines – 634 and 635 – left uncommented, which refer to sample RewrideCond / RewriteRule statements.

I do not know what is the source of these uncommented lines, but commenting them again made Apache load the config file correctly and I am now able to upload images to Neos normally.

Konrad

; List of separator(s) used by PHP to parse input URLs into variables.
; PHP's default setting is "&".
; NOTE: Every character in this directive is considered as separator!
; https://php.net/arg-separator.input
; Example:
; RewriteCond %{SERVER_NAME} =neos.brynda.ch
; RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
; arg_separator.input = ";&"