There is major bug between Drupal 8 and H5P module.
Let me explain the steps to regenerate this bug:
1. Let's say we have 2 sites: Site A(Drupal 8) and any other Site B;
2. On Drupal Site A install & enable H5P module;
3. Add H5P interactive field in any content type, let's say "Article";
4. Create "Article" with "H5P content"(doesn't matter which one), for examp. "True/False";
5. In H5P field check "Embed button" and save the node;
6. Go to Site A created node URL, you will see that - node with "H5P content" working fine;
7. Scroll down the node and under created "True/False question" block click "embed" button, the pop-up window should appear with iframe generated code for external sites;
6. Now insert generated iframe code into Site B and save;
7. Ok, let's come back to Site A, go to administration and "Clear all caches"(or you can use in console: drush cr);
8. Now, go to Site B and open the URL where our iframe was inserted, for examp: "http://siteB.com/path-of-page-where-iframe-from-siteA-was-inserted";
9. You will get next error there: "The website encountered an unexpected error. Please try again later.";
10. Also you can see this error if you put iframe's generated URL directly into browser address bar, for examp:"http://siteA.com/en/h5p/1/embed"
11. Again, go back to Site A and see the log messages:
LogicException: The controller result claims to be providing
relevant cache metadata, but leaked metadata was detected. Please
ensure you are not rendering content too early. Returned object class:
Drupal\Core\Render\HtmlResponse. in
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
(line 154 of /home/user/web/siteA.com/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php).12. (IMPORTANT!) Problem appears, for users who are NOT authenticated in Site A. So, the content cache is not generated for anonymous users after cache clearing;
13. If we try to open URL for examp.: "http://siteA.com/en/h5p/1/embed" or "http://siteB.com/path-of-page-where-iframe-from-siteA-was-inserted" as a Site A authenticated user, content cache will generate and now anonymous users also can see it without any errors UNTIL next Site A clear caching;
Any ideas?
Comments
Comment #2
emka commentedComment #3
emka commentedComment #4
emka commentedComment #5
emka commentedComment #6
paalj commentedI have created an issue here: https://h5ptechnology.atlassian.net/browse/HFP-1971
Comment #7
bevangg commentedBump.
Exact same problem
Comment #9
paalj commentedWith a little help from https://www.drupal.org/project/drupal/issues/2638686, I seem to have found & fixed the problem. Could any of you validate my fix?, then I will release it.
Comment #10
rstotland commentedHave what appears to be the same issue. New install of D8 and H5P, works as expected while on the site but embedding the code or going to generated code gives error:
@paalj I would be more than willing to test this as we really need this functionality in upgrading our systems from D7 to D8 with H5P. Thank you
Roman
Comment #11
paalj commented@rstotland: The bug you see has been fixed (but is not released yet): https://cgit.drupalcode.org/h5p/commit/?id=3bad904
Comment #12
rstotland commentedThank you @paalj, i tested the code you have mentioned and the content loads now with the embed link, now trying to resolve the x-frame-options so we can actually embed from our D8 site.
Thank you again
Comment #13
paalj commentedThis was fixed in the 8.x-1.0-rc8 release
Comment #14
paalj commented