Drupal 8 file upload issue

When attempting to create new content that uses an H5P element, on "save" I get this error:

This value should not be null.

and the file upload input is highlighted in red. The file was uploaded and unzipped to the sites/files/h5p/temp directory, where it was placed in an h5p-[13-digit-alphanumeric] directory before the process ABENDed.

On page refresh (F5), after the form resubmits these error messages are finally exposed:

The file could not be saved because the upload did not complete.
File upload error. Could not move uploaded file.
The uploaded file doesn't have the required '.h5p' extension

upload_max_filesize and post_max_size were both reset to 128M, to no effect. The two packages listed below, when unzipped to the temp directory, are 2.7M and 2.8M respectively. 

Drupal v8.5.4

modules: 

    H5P v8.x-1.0-rc7 (enabled)

    H5P Editor v8.x-1.0-rc7 (enabled)

H5P packages:

    multiple-choice-713.h5p

    true-false-question-34806.h5p

Firefox, latest version, desktop, no console errors. Mostly ditto with Google Chrome, latest version (no additional errors on refresh)

No PHP errors to the apache2 error.log file (which PHP logs to) or displayed on screen (xdebug is installed)

Nothing meaningful in Watchdog (says Notice:The file public://h5p/temp/h5p-5b35127dd907e/multiple-choice-713.h5p was not deleted because it does not exist.)

No config or other issues reported under Reports > Status Report (file system is writable)

I am running Drupal on Ubuntu 18.04, with Ubuntu as a Guest VM under VirtualBox v5.2.12, with Windows 10 as Host. vbox extensions and guest additions are installed.

I am logged into drupal as user 1 (root)

 

This looks like a really nasty bug, but where exactly? Or am I doing something wrong even though I followed the instructions at https://h5p.org/documentation/setup/drupal8 ?

 

Summary: 
problem uploading h5p packages on drupal 8
icc's picture

Try changing the field form widget to H5P Editor and try the upload feature in the Hub.

The instructions at https://www.drupal.org/project/h5p were a bit more clear:

  1. Install the H5P module as you would install any other Drupal module.
  2. Enable the H5P and H5P Editor modules
  3. Add an H5P field to a content type (admin/structure/types/manage/your-conten-type/fields)
  4. Go to Manage form display, and choose H5P Editor as widget for the H5P field

That said, my domain is "drupal.test", it's homed in my /www/drupal/ directory because I'm doing dev work in a local environment. I'm getting this nonsense:

  • Error creating resource: [message] fopen(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed [file] /www/drupal/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php [line] 324 [message] fopen(): Failed to enable crypto [file] /www/drupal/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php [line] 324 [message] fopen(https://api.h5p.org/v1/sites): failed to open stream: operation failed [file] /www/drupal/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php [line] 324
  • Site could not be registered with the hub. Please contact your site administrator.
  • The H5P Hub has been disabled until this problem can be resolved. You may still upload libraries through the "H5P Libraries" page.


There is no SSL cert so that's likely the reason fopen() SSL failed with code 1. If I create a snakeoil cert, that brings its own issues, done it before and hoped it wouldn't be needed here. Is there a workaround that doesn't involve snakeoil SSL certs? 

Is the lack of an SSL cert for the dummy domain what is causing the !@#$ error if I attempt to upload an archive file that was downloaded from H5P.org? Because there needs to be a much better error messaging if that is the case.

icc's picture

It looks like your server/environment isn't able to verify the certificate of h5p.org. I guess this could be caused by a number of things, the host machine of the VM manipulating the request in some manner, the issuer not being trusted or something simple like the system clock not being correct.

So, I should check to verify SSL is enabled under Apache, even if I don't create a snakeoil cert?
I'll look into that, that functionality should be present and enabled whether I create a self-signed cert or not. 

I'll report back, once I get back to that (might take a few hours).

Hit the wrong "reply" button, now can't delete the other comment/reply and reply here - please see reply below.

So openssl was enabled under PHP, but mod_ssl was not enabled under apache2. I enabled it. Will proceed with a new round of testing, presently.