JS loading problems with Drupal11

Created on 13 August 2025, about 2 months ago
Updated 24 August 2025, about 1 month ago

Problem/Motivation

After updating from Drupal 10 with h5p 2.0.0-alpha4 to Drupal 11 with h5p 2.0.0-alpha5/6 I', finding loading errors in the browser console and following h5p scripts/settings are missing:

GET https://site.url/apps/[object Object]
NS_ERROR_CORRUPTED_CONTENT
GET https://site.url/apps/[object%20Object]
Status 404

call stack:

writeDocument			https://site.url/sites/default/files/js/js_eASfAAttq7mxI3zkv8BvVn4gDudsFbM-40Sa6w8Cwjw.js:2:7196
H5P.init/<				https://site.url/sites/default/files/js/js_eASfAAttq7mxI3zkv8BvVn4gDudsFbM-40Sa6w8Cwjw.js:2:7570
each					https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:2976
each					https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:1454
H5P.init				https://site.url/sites/default/files/js/js_eASfAAttq7mxI3zkv8BvVn4gDudsFbM-40Sa6w8Cwjw.js:2:6806
<anonym>				https://site.url/sites/default/files/js/js_eASfAAttq7mxI3zkv8BvVn4gDudsFbM-40Sa6w8Cwjw.js:8:27114
e						https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:30005
Deferred/then/l/</t<	https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:30307
(Async: setTimeout handler) 
Deferred/then/l/<		https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:30516
c						https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:28294
fireWith				https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:29039
fire					https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:29075
c						https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:28294
fireWith				https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:29039
ready					https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:32012
B						https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:31791
(Async: EventListener.handleEvent) 
<anonym>				https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:32160
<anonym>				https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:220
<anonym>				https://site.url/modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js:2:225

Following is the error:

Missing H5PIntegration settings.

There seems to happen some object->string coercion which leads to the required config not being loaded.

looking into the vars this seems to be confimed; in contents[cid].scripts at index 0 there's a complete drupalSettings object, while h5p is expecting string urls, thus resulting in "/[object Object]".

const cid = Object.keys((H5PIntegration||drupalSettings.h5pIntegration).contents)[0];
(H5PIntegration||drupalSettings.h5pIntegration).contents[cid].scripts
Array(4) [ {…}, "/sites/default/files/js/js_Xhj2nrBnnCh0nJVht4I-TTy6ZcWGEeBM2cdKnH2YgVk.js?scope=footer&delta=0&language=de&theme=appsis&include=eJzLMC3QzzAt0EtMKUvMS05NKUmtKNE11DPUyYBKlGQUpaZm5iamp1aV5uoa6JkCALUiEQo", "modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js", "/sites/default/files/js/js_9TZjEr24pImtSm_URozspPXtGtp9Zgh0xGTNYbPnW4A.js?scope=footer&delta=2&language=de&theme=appsis&include=eJzLMC3QzzAt0EtMKUvMS05NKUmtKNE11DPUyYBKlGQUpaZm5iamp1aV5uoa6JkCALUiEQo" ]
​
0: Object { path: {…}, pluralDelimiter: "\u0003", user: {…} }
​​
path: Object { baseUrl: "/", currentPath: "node/29667", currentPathIsAdmin: false, … }
​​​
baseUrl: "/"
​​​
currentLanguage: "de"
​​​
currentPath: "node/29667"
​​​
currentPathIsAdmin: false
​​​
isFront: false
​​​
pathPrefix: ""
​​​
<prototype>: Object { … }
​​
pluralDelimiter: "\u0003"
​​
user: Object { uid: "1", permissionsHash: "is-admin" }
​​​
permissionsHash: "is-admin"
​​​
uid: "1"
​​​
<prototype>: Object { … }
​​
<prototype>: Object { … }
​
1: "/sites/default/files/js/js_Xhj2nrBnnCh0nJVht4I-TTy6ZcWGEeBM2cdKnH2YgVk.js?scope=footer&delta=0&language=de&theme=appsis&include=eJzLMC3QzzAt0EtMKUvMS05NKUmtKNE11DPUyYBKlGQUpaZm5iamp1aV5uoa6JkCALUiEQo"
​
2: "modules/contrib/h5p/vendor/h5p/h5p-core/js/jquery.js"
​
3: "/sites/default/files/js/js_9TZjEr24pImtSm_URozspPXtGtp9Zgh0xGTNYbPnW4A.js?scope=footer&delta=2&language=de&theme=appsis&include=eJzLMC3QzzAt0EtMKUvMS05NKUmtKNE11DPUyYBKlGQUpaZm5iamp1aV5uoa6JkCALUiEQo"
​
length: 4
​
<prototype>: Array []

Steps to reproduce

Update from D10 to D11, thus from h5p 2.0.0-alpha4 to alpha5/6 (concerns both).
Load a page with h5p content.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

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.

Production build 0.71.5 2024