Uncaught TypeError on Dialog Cards and Course Presentation types

Running Drupal H5P module.  Everything was working without issue until today when I started seeing the following errors.   Drupal 8.8.5 with version 8.x-1.0-rc17 of the H5P module.

I'm getting uncaught type errors on multiple H5P types in our Drupal site.  This was all working without issue, but today started seeing these errors.  I see it with the Course Presentation type, and with Dialog Cards.  When we try to create a course presentation, the presentation canvas tries to load, it just says "Loading", and the console shows this error:

drag-n-bar.js?ver=1.5.10:26 Uncaught TypeError: H5P.DragNDrop is not a constructor

    at new DragNBar (drag-n-bar.js?ver=1.5.10:26)

    at cp-editor.js?ver=1.21.3:518

    at Object.llc.getLibraries (h5peditor-library-list-cache.js?qbdo3p:47)

    at Object.llc.runQue (h5peditor-library-list-cache.js?qbdo3p:78)

    at Object.success (h5peditor-library-list-cache.js?qbdo3p:59)

    at c (jquery.js?qbdo3p:2)

    at Object.fireWith [as resolveWith] (jquery.js?qbdo3p:2)

    at k (jquery.js?qbdo3p:4)

    at XMLHttpRequest.r (jquery.js?qbdo3p:4)

 

For Dialog cards, I'm getting the following error.  The Dialog Card title, heading, mode and task description fields load, but the actual Dialog Card functionality does not load (for us to add the images, question and answer.  Error in console:

h5peditor-semantic-structure.js?qbdo3p:210 Uncaught TypeError: Cannot read property 'name' of undefined

    at List.SemanticStructure.self.appendTo (h5peditor-semantic-structure.js?qbdo3p:210)

    at Object.ns.processSemanticsChunk (h5peditor.js?qbdo3p:475)

    at ns.Form.processSemantics (h5peditor-form.js?qbdo3p:440)

    at h5peditor-library-selector.js?qbdo3p:269

    at h5peditor.js?qbdo3p:224

    at Object.ns.libraryRequested (h5peditor.js?qbdo3p:151)

    at Object.success (h5peditor.js?qbdo3p:223)

    at c (jquery.js?qbdo3p:2)

    at Object.fireWith [as resolveWith] (jquery.js?qbdo3p:2)

    at k (jquery.js?qbdo3p:4)

SemanticStructure.self.appendTo @ h5peditor-semantic-structure.js?qbdo3p:210

ns.processSemanticsChunk @ h5peditor.js?qbdo3p:475

ns.Form.processSemantics @ h5peditor-form.js?qbdo3p:440

(anonymous) @ h5peditor-library-selector.js?qbdo3p:269

(anonymous) @ h5peditor.js?qbdo3p:224

ns.libraryRequested @ h5peditor.js?qbdo3p:151

success @ h5peditor.js?qbdo3p:223

c @ jquery.js?qbdo3p:2

fireWith @ jquery.js?qbdo3p:2

k @ jquery.js?qbdo3p:4

r @ jquery.js?qbdo3p:4

XMLHttpRequest.send (async)

send @ jquery.js?qbdo3p:4

ajax @ jquery.js?qbdo3p:4

ns.loadLibrary @ h5peditor.js?qbdo3p:203

ns.LibrarySelector.loadSemantics @ h5peditor-library-selector.js?qbdo3p:238

librarySelectHandler @ h5peditor-library-selector.js?qbdo3p:56

ns.SelectorHub.getSelectedLibrary @ h5peditor-selector-hub.js?qbdo3p:225

loadLibrary @ h5peditor-library-selector.js?qbdo3p:68

call @ h5p-event-dispatcher.js?qbdo3p:209

EventDispatcher.trigger @ h5p-event-dispatcher.js?qbdo3p:240

(anonymous) @ h5peditor-selector-hub.js?qbdo3p:58

(anonymous) @ h5p-hub-client.js?qbdo3p:45

trigger @ h5p-hub-client.js?qbdo3p:45

n.handleUse @ h5p-hub-client.js?qbdo3p:33

n.handleDetailUse @ h5p-hub-client.js?qbdo3p:40

n.handleUse @ h5p-hub-client.js?qbdo3p:40

u @ h5p-hub-client.js?qbdo3p:25

invokeGuardedCallback @ h5p-hub-client.js?qbdo3p:33

invokeGuardedCallbackAndCatchFirstError @ h5p-hub-client.js?qbdo3p:33

h @ h5p-hub-client.js?qbdo3p:25

b @ h5p-hub-client.js?qbdo3p:25

g @ h5p-hub-client.js?qbdo3p:25

m @ h5p-hub-client.js?qbdo3p:25

T @ h5p-hub-client.js?qbdo3p:25

qr @ h5p-hub-client.js?qbdo3p:33

ke @ h5p-hub-client.js?qbdo3p:25

batchedUpdates @ h5p-hub-client.js?qbdo3p:25

J @ h5p-hub-client.js?qbdo3p:25

Me @ h5p-hub-client.js?qbdo3p:25

The drop zone functionality is no longer available.  Error:

Uncaught TypeError: H5P.DragNDrop is not a constructor

    at new DragNBar (drag-n-bar.js?ver=1.5.10:26)

    at C.H5PEditor.widgets.dragQuestion.H5PEditor.DragQuestion.C.activateEditor (H5PEditor.DragQuestion.js?ver=1.10.11:346)

    at H5PEditor.DragQuestion.js?ver=1.10.11:280

    at Object.success (h5peditor-library-list-cache.js?qbdo3p:58)

    at c (jquery.js?qbdo3p:2)

    at Object.fireWith [as resolveWith] (jquery.js?qbdo3p:2)

    at k (jquery.js?qbdo3p:4)

    at XMLHttpRequest.r (jquery.js?qbdo3p:4)

The Dialog Card title, heading, mode and task description fields load, but the actual Dialog Card functionality does not load (for us to add the images, question and answer.  Error in console:

h5peditor-semantic-structure.js?qbdo3p:210 Uncaught TypeError: Cannot read property 'name' of undefined     at List.SemanticStructure.self.appendTo (h5peditor-semantic-structure.js?qbdo3p:210)     at Object.ns.processSemanticsChunk (h5peditor.js?qbdo3p:475)     at ns.Form.processSemantics (h5peditor-form.js?qbdo3p:440) 

 

Comments:

I was also facing the same exact issue in my setup, On setup dialog card activity working and other not working.

Issues related to:  libraries of "Dialog card" activity info not maintained at db level properly and as well its dependent libraries when installed the dialog card activity

Solution: In Drupal 8 libraries related data/Info maintained in 'h5p_libraries_libraries'  table.
                 So the setup on which dialog card activity working fine , I exported the 'h5p_libraries_libraries'  table and then imported the table of databse of setup on which I was facing issue and issue fixed.

Correct Table sql file content here:

-- Adminer 4.7.7 MySQL dump

 

SET NAMES utf8;

SET time_zone = '+00:00';

SET foreign_key_checks = 0;

SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';

 

SET NAMES utf8mb4;

 

DROP TABLE IF EXISTS `h5p_libraries_libraries`;

CREATE TABLE `h5p_libraries_libraries` (

  `library_id` int(10) unsigned NOT NULL COMMENT 'Primary Key: The id of a h5p library.',

  `required_library_id` int(10) unsigned NOT NULL COMMENT 'Primary Key: The id of a h5p library.',

  `dependency_type` varchar(31) NOT NULL COMMENT 'preloaded, dynamic, or editor',

  PRIMARY KEY (`library_id`,`required_library_id`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Stores information about library dependencies.';

 

INSERT INTO `h5p_libraries_libraries` (`library_id`, `required_library_id`, `dependency_type`) VALUES

(1,107,'preloaded'),

(4,3,'preloaded'),

(6,58,'preloaded'),

(6,82,'editor'),

(6,102,'editor'),

(8,3,'preloaded'),

(8,113,'preloaded'),

(9,3,'preloaded'),

(9,113,'preloaded'),

(10,3,'preloaded'),

(10,48,'preloaded'),

(10,58,'preloaded'),

(10,73,'preloaded'),

(10,93,'editor'),

(10,96,'editor'),

(12,81,'editor'),

(15,3,'preloaded'),

(15,32,'preloaded'),

(15,48,'preloaded'),

(15,83,'editor'),

(16,3,'preloaded'),

(16,9,'preloaded'),

(16,48,'preloaded'),

(16,96,'editor'),

(16,102,'editor'),

(17,8,'preloaded'),

(17,48,'preloaded'),

(17,58,'preloaded'),

(17,73,'preloaded'),

(17,93,'editor'),

(17,96,'editor'),

(17,102,'editor'),

(18,3,'preloaded'),

(18,29,'preloaded'),

(18,48,'preloaded'),

(18,105,'preloaded'),

(18,112,'preloaded'),

(19,3,'preloaded'),

(19,29,'preloaded'),

(19,48,'preloaded'),

(19,105,'preloaded'),

(19,112,'preloaded'),

(20,3,'preloaded'),

(20,48,'preloaded'),

(20,102,'editor'),

(21,3,'preloaded'),

(21,48,'preloaded'),

(21,102,'editor'),

(22,24,'preloaded'),

(22,25,'preloaded'),

(22,32,'preloaded'),

(23,24,'preloaded'),

(23,25,'preloaded'),

(23,32,'preloaded'),

(26,3,'preloaded'),

(26,48,'preloaded'),

(26,58,'preloaded'),

(26,84,'editor'),

(26,93,'editor'),

(26,96,'editor'),

(26,114,'preloaded'),

(27,3,'preloaded'),

(27,48,'preloaded'),

(27,58,'preloaded'),

(27,93,'editor'),

(27,114,'preloaded'),

(28,48,'preloaded'),

(28,57,'preloaded'),

(28,72,'preloaded'),

(28,93,'editor'),

(28,96,'editor'),

(28,102,'editor'),

(29,110,'preloaded'),

(30,111,'preloaded'),

(30,112,'preloaded'),

(31,3,'preloaded'),

(31,32,'preloaded'),

(31,48,'preloaded'),

(31,102,'editor'),

(33,3,'preloaded'),

(33,11,'preloaded'),

(34,48,'preloaded'),

(34,100,'editor'),

(35,105,'preloaded'),

(36,3,'preloaded'),

(36,48,'preloaded'),

(36,105,'preloaded'),

(37,106,'preloaded'),

(39,49,'preloaded'),

(39,82,'editor'),

(39,94,'editor'),

(39,96,'editor'),

(39,100,'editor'),

(39,101,'editor'),

(41,58,'preloaded'),

(41,87,'editor'),

(41,104,'editor'),

(42,3,'preloaded'),

(42,76,'preloaded'),

(42,82,'editor'),

(42,86,'editor'),

(42,96,'editor'),

(44,56,'preloaded'),

(44,88,'editor'),

(44,103,'editor'),

(45,3,'preloaded'),

(45,48,'preloaded'),

(45,102,'editor'),

(45,114,'preloaded'),

(46,3,'preloaded'),

(46,23,'preloaded'),

(46,79,'preloaded'),

(46,89,'editor'),

(46,104,'editor'),

(46,114,'preloaded'),

(47,1,'preloaded'),

(47,3,'preloaded'),

(47,76,'preloaded'),

(48,1,'preloaded'),

(48,3,'preloaded'),

(48,32,'preloaded'),

(48,76,'preloaded'),

(49,101,'editor'),

(50,3,'preloaded'),

(50,48,'preloaded'),

(50,58,'preloaded'),

(50,93,'editor'),

(51,3,'preloaded'),

(51,75,'preloaded'),

(51,82,'editor'),

(51,102,'editor'),

(52,3,'preloaded'),

(52,75,'preloaded'),

(52,80,'editor'),

(52,82,'editor'),

(52,102,'editor'),

(53,2,'preloaded'),

(53,3,'preloaded'),

(53,48,'preloaded'),

(53,58,'preloaded'),

(53,93,'editor'),

(53,96,'editor'),

(56,3,'preloaded'),

(56,47,'preloaded'),

(57,3,'preloaded'),

(57,48,'preloaded'),

(58,3,'preloaded'),

(58,48,'preloaded'),

(59,2,'preloaded'),

(59,3,'preloaded'),

(59,48,'preloaded'),

(59,79,'preloaded'),

(59,90,'editor'),

(59,93,'editor'),

(59,96,'editor'),

(59,102,'editor'),

(60,3,'preloaded'),

(60,55,'preloaded'),

(60,62,'preloaded'),

(60,102,'editor'),

(61,82,'editor'),

(61,95,'editor'),

(61,96,'editor'),

(63,3,'preloaded'),

(63,48,'preloaded'),

(63,58,'preloaded'),

(63,64,'preloaded'),

(63,76,'preloaded'),

(63,93,'editor'),

(63,96,'editor'),

(63,97,'editor'),

(63,102,'editor'),

(65,40,'preloaded'),

(65,69,'preloaded'),

(65,70,'preloaded'),

(65,105,'preloaded'),

(66,40,'preloaded'),

(66,69,'preloaded'),

(66,71,'preloaded'),

(66,105,'preloaded'),

(67,3,'preloaded'),

(67,48,'preloaded'),

(67,58,'preloaded'),

(67,93,'editor'),

(67,98,'editor'),

(74,108,'preloaded'),

(77,3,'preloaded'),

(77,32,'preloaded'),

(77,48,'preloaded'),

(77,58,'preloaded'),

(77,91,'editor'),

(77,96,'editor'),

(79,113,'preloaded'),

(80,3,'preloaded'),

(80,32,'preloaded'),

(81,3,'preloaded'),

(81,12,'preloaded'),

(83,3,'preloaded'),

(83,5,'preloaded'),

(83,7,'preloaded'),

(83,9,'preloaded'),

(83,10,'preloaded'),

(83,14,'preloaded'),

(83,15,'preloaded'),

(83,16,'preloaded'),

(83,23,'preloaded'),

(83,26,'preloaded'),

(83,27,'preloaded'),

(83,30,'preloaded'),

(83,32,'preloaded'),

(83,40,'preloaded'),

(83,46,'preloaded'),

(83,49,'preloaded'),

(83,50,'preloaded'),

(83,53,'preloaded'),

(83,61,'preloaded'),

(83,63,'preloaded'),

(83,67,'preloaded'),

(83,68,'preloaded'),

(83,77,'preloaded'),

(83,78,'preloaded'),

(83,79,'preloaded'),

(83,82,'preloaded'),

(83,92,'preloaded'),

(84,3,'preloaded'),

(84,5,'preloaded'),

(84,23,'preloaded'),

(84,40,'preloaded'),

(84,48,'preloaded'),

(84,104,'preloaded'),

(84,114,'preloaded'),

(86,3,'preloaded'),

(87,23,'preloaded'),

(87,25,'preloaded'),

(87,41,'preloaded'),

(88,22,'preloaded'),

(88,25,'preloaded'),

(88,44,'preloaded'),

(89,3,'preloaded'),

(89,10,'preloaded'),

(89,23,'preloaded'),

(89,26,'preloaded'),

(89,27,'preloaded'),

(89,32,'preloaded'),

(89,33,'preloaded'),

(89,34,'preloaded'),

(89,37,'preloaded'),

(89,39,'preloaded'),

(89,40,'preloaded'),

(89,46,'preloaded'),

(89,49,'preloaded'),

(89,50,'preloaded'),

(89,53,'preloaded'),

(89,54,'preloaded'),

(89,60,'preloaded'),

(89,63,'preloaded'),

(89,67,'preloaded'),

(89,68,'preloaded'),

(89,69,'preloaded'),

(89,77,'preloaded'),

(89,82,'preloaded'),

(89,85,'preloaded'),

(89,94,'preloaded'),

(89,100,'preloaded'),

(93,99,'preloaded'),

(95,3,'preloaded'),

(102,3,'preloaded'),

(104,32,'preloaded'),

(106,107,'preloaded'),

(111,115,'preloaded'),

(112,109,'preloaded'),

(116,3,'preloaded'),

(116,48,'preloaded'),

(116,58,'preloaded'),

(116,73,'preloaded'),

(116,93,'editor'),

(117,3,'preloaded'),

(117,48,'preloaded'),

(117,58,'preloaded'),

(117,93,'editor'),

(117,96,'editor'),

(117,114,'preloaded'),

(117,127,'editor'),

(118,3,'preloaded'),

(118,48,'preloaded'),

(118,58,'preloaded'),

(118,93,'editor'),

(118,114,'preloaded'),

(120,3,'preloaded'),

(120,22,'preloaded'),

(120,104,'editor'),

(120,114,'preloaded'),

(120,126,'preloaded'),

(120,128,'editor'),

(121,3,'preloaded'),

(121,48,'preloaded'),

(121,58,'preloaded'),

(121,93,'editor'),

(122,2,'preloaded'),

(122,3,'preloaded'),

(122,48,'preloaded'),

(122,58,'preloaded'),

(122,93,'editor'),

(123,3,'preloaded'),

(123,48,'preloaded'),

(123,58,'preloaded'),

(123,64,'preloaded'),

(123,76,'preloaded'),

(123,93,'editor'),

(123,96,'editor'),

(123,97,'editor'),

(123,102,'editor'),

(124,3,'preloaded'),

(124,48,'preloaded'),

(124,58,'preloaded'),

(124,93,'editor'),

(124,98,'editor'),

(125,3,'preloaded'),

(125,32,'preloaded'),

(125,48,'preloaded'),

(125,58,'preloaded'),

(125,91,'editor'),

(126,113,'preloaded'),

(127,3,'preloaded'),

(127,5,'preloaded'),

(127,22,'preloaded'),

(127,48,'preloaded'),

(127,104,'preloaded'),

(127,114,'preloaded'),

(127,119,'preloaded'),

(128,3,'preloaded'),

(128,22,'preloaded'),

(128,32,'preloaded'),

(128,33,'preloaded'),

(128,34,'preloaded'),

(128,37,'preloaded'),

(128,39,'preloaded'),

(128,49,'preloaded'),

(128,54,'preloaded'),

(128,60,'preloaded'),

(128,68,'preloaded'),

(128,69,'preloaded'),

(128,82,'preloaded'),

(128,85,'preloaded'),

(128,94,'preloaded'),

(128,100,'preloaded'),

(128,116,'preloaded'),

(128,117,'preloaded'),

(128,118,'preloaded'),

(128,119,'preloaded'),

(128,120,'preloaded'),

(128,121,'preloaded'),

(128,122,'preloaded'),

(128,123,'preloaded'),

(128,124,'preloaded'),

(128,125,'preloaded'),

(129,3,'preloaded'),

(129,113,'preloaded'),

(130,3,'preloaded'),

(130,32,'preloaded'),

(130,48,'preloaded'),

(130,133,'editor'),

(131,3,'preloaded'),

(131,48,'preloaded'),

(131,102,'editor'),

(131,129,'preloaded'),

(132,111,'preloaded'),

(132,112,'preloaded'),

(133,3,'preloaded'),

(133,5,'preloaded'),

(133,7,'preloaded'),

(133,14,'preloaded'),

(133,22,'preloaded'),

(133,32,'preloaded'),

(133,49,'preloaded'),

(133,68,'preloaded'),

(133,78,'preloaded'),

(133,82,'preloaded'),

(133,92,'preloaded'),

(133,116,'preloaded'),

(133,117,'preloaded'),

(133,118,'preloaded'),

(133,119,'preloaded'),

(133,120,'preloaded'),

(133,121,'preloaded'),

(133,122,'preloaded'),

(133,123,'preloaded'),

(133,124,'preloaded'),

(133,125,'preloaded'),

(133,126,'preloaded'),

(133,129,'preloaded'),

(133,130,'preloaded'),

(133,131,'preloaded'),

(133,132,'preloaded'),

(134,3,'preloaded'),

(134,48,'preloaded'),

(134,75,'preloaded'),

(135,3,'preloaded'),

(135,32,'preloaded'),

(135,48,'preloaded'),

(135,138,'editor'),

(136,3,'preloaded'),

(136,23,'preloaded'),

(136,79,'preloaded'),

(136,104,'editor'),

(136,114,'preloaded'),

(136,139,'editor'),

(137,3,'preloaded'),

(137,55,'preloaded'),

(137,62,'preloaded'),

(137,102,'editor'),

(138,3,'preloaded'),

(138,5,'preloaded'),

(138,7,'preloaded'),

(138,9,'preloaded'),

(138,10,'preloaded'),

(138,14,'preloaded'),

(138,16,'preloaded'),

(138,23,'preloaded'),

(138,26,'preloaded'),

(138,27,'preloaded'),

(138,30,'preloaded'),

(138,32,'preloaded'),

(138,40,'preloaded'),

(138,49,'preloaded'),

(138,50,'preloaded'),

(138,53,'preloaded'),

(138,61,'preloaded'),

(138,63,'preloaded'),

(138,67,'preloaded'),

(138,68,'preloaded'),

(138,77,'preloaded'),

(138,78,'preloaded'),

(138,79,'preloaded'),

(138,82,'preloaded'),

(138,92,'preloaded'),

(138,135,'preloaded'),

(138,136,'preloaded'),

(139,3,'preloaded'),

(139,10,'preloaded'),

(139,23,'preloaded'),

(139,26,'preloaded'),

(139,27,'preloaded'),

(139,32,'preloaded'),

(139,33,'preloaded'),

(139,34,'preloaded'),

(139,37,'preloaded'),

(139,39,'preloaded'),

(139,40,'preloaded'),

(139,49,'preloaded'),

(139,50,'preloaded'),

(139,53,'preloaded'),

(139,54,'preloaded'),

(139,63,'preloaded'),

(139,67,'preloaded'),

(139,68,'preloaded'),

(139,69,'preloaded'),

(139,77,'preloaded'),

(139,82,'preloaded'),

(139,85,'preloaded'),

(139,94,'preloaded'),

(139,100,'preloaded'),

(139,136,'preloaded'),

(139,137,'preloaded'),

(140,48,'preloaded'),

(140,64,'preloaded'),

(140,96,'editor'),

(140,141,'preloaded'),

(142,82,'editor'),

(143,3,'preloaded'),

(144,145,'editor'),

(146,3,'preloaded'),

(146,32,'preloaded'),

(147,3,'preloaded'),

(147,58,'preloaded'),

(148,3,'preloaded'),

(148,48,'preloaded'),

(148,75,'preloaded'),

(148,102,'editor'),

(148,114,'preloaded'),

(148,129,'preloaded'),

(149,3,'preloaded'),

(149,58,'preloaded'),

(149,93,'editor'),

(149,96,'editor'),

(149,102,'editor'),

(151,96,'editor'),

(152,3,'preloaded'),

(152,96,'editor'),

(152,155,'editor'),

(153,3,'preloaded'),

(153,96,'editor'),

(153,156,'editor'),

(156,5,'preloaded'),

(156,40,'preloaded'),

(156,42,'preloaded'),

(156,79,'preloaded'),

(156,135,'preloaded'),

(156,136,'preloaded'),

(156,152,'preloaded'),

(156,153,'preloaded'),

(156,154,'preloaded'),

(158,80,'editor'),

(158,91,'editor'),

(158,96,'editor'),

(158,157,'editor'),

(158,160,'preloaded'),

(158,161,'editor'),

(160,159,'preloaded'),

(161,3,'preloaded'),

(161,32,'preloaded'),

(161,158,'preloaded'),

(163,3,'preloaded'),

(163,48,'preloaded'),

(163,96,'editor'),

(163,102,'editor'),

(163,162,'preloaded'),

(164,82,'editor'),

(164,96,'editor'),

(165,3,'preloaded'),

(165,9,'preloaded'),

(165,79,'preloaded'),

(165,96,'editor'),

(165,102,'editor');

 

 

-- 2021-05-08 10:38:22

 

 

 

 
otacke's picture

Hi Pooja_Sharma and others!

BE CAREFUL! The ids of the libraries depend on the order in which they are installed and updated, so they will differ from platform to platform. Thus, dropping the libraries_libraries table and then running that insert query will therefore most likely wreck your system.

Best,
Oliver