Problem/Motivation

After upgrade to RC1 i have this error.
if i disable module i have no errors

thank you

Uncaught TypeError: originalJQOnce is undefined
    augmentedOnce jQuery
    loadAjaxBehavior https://localhost/core/misc/ajax.js?v=9.3.6:32
    attach https://localhost/core/misc/ajax.js?v=9.3.6:40
    attach https://localhost/core/misc/ajax.js?v=9.3.6:39
    attachBehaviors https://localhost/core/misc/drupal.js?v=9.3.6:27
    attachBehaviors https://localhost/core/misc/drupal.js?v=9.3.6:24
    <anonymous> https://localhost/core/misc/drupal.init.js?v=9.3.6:29
    listener https://localhost/core/misc/drupal.init.js?v=9.3.6:17
    domReady https://localhost/core/misc/drupal.init.js?v=9.3.6:24
    <anonymous> https://localhost/core/misc/drupal.init.js?v=9.3.6:28
    <anonymous> https://localhost/core/misc/drupal.init.js?v=9.3.6:31
jquery.once.bc.js:30:5
    augmentedOnce jQuery
    loadAjaxBehavior https://localhost/core/misc/ajax.js?v=9.3.6:32
    attach https://localhost/core/misc/ajax.js?v=9.3.6:40
    forEach self-hosted:208
    attach https://localhost/core/misc/ajax.js?v=9.3.6:39
    attachBehaviors https://localhost/core/misc/drupal.js?v=9.3.6:27
    forEach self-hosted:208
    attachBehaviors https://localhost/core/misc/drupal.js?v=9.3.6:24
    <anonymous> https://localhost/core/misc/drupal.init.js?v=9.3.6:29
    listener https://localhost/core/misc/drupal.init.js?v=9.3.6:17
    (Async: EventListener.handleEvent)
    domReady https://localhost/core/misc/drupal.init.js?v=9.3.6:24
    <anonymous> https://localhost/core/misc/drupal.init.js?v=9.3.6:28
    <anonymous> https://localhost/core/misc/drupal.init.js?v=9.3.6:31
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

trickfun created an issue. See original summary.

ropic’s picture

+1 same problem

mach_25’s picture

It looks like the module is using a deprecated function "once".

To fix the issue without code changes add `- core/jquery.once` to dependencies in facebook_pixel.libraries.yml

And to fix the deprecated code there is a guide here https://www.drupal.org/node/3158256

c_archer’s picture

StatusFileSize
new299 bytes
johnnydarkko’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new96.88 KB

Thank you! The patch in #4 also fixes an issue where I was seeing errors like this appear in the console:

Uncaught TypeError: Cannot read properties of undefined (reading 'apply')
    at augmentedOnce (jquery.once.bc.js?v=9.3.9:30:20)
    at Function.Drupal.ajax.bindAjaxLinks (ajax.js?v=9.3.9:142:5)
    at Object.attach (ajax.js?v=9.3.9:42:19)
    at drupal.js?v=9.3.9:29:24
    at Array.forEach (<anonymous>)
    at Object.Drupal.attachBehaviors (drupal.js?v=9.3.9:26:34)
    at drupal.init.js?v=9.3.9:31:12
    at HTMLDocument.listener (drupal.init.js?v=9.3.9:19:7)

 Cannot read properties of undefined (reading 'apply'...

Patch simply adds the once library and looks good to go! Moving to RTBC

kaszarobert’s picture

Patch #4 fixes the problem for now.

But don't forget that since Drupal 9.2 drupal/jquery.once is deprecated (https://www.drupal.org/node/3158256). So, when Drupal 10 comes, the JS needs to be rewritten to using core/once instead.

bas123’s picture

Quick question!

If I run composer require 'drupal/facebook_pixel:^2.0@RC' now to install this on a live Production site, has the patch been integrated, or do I need to run the patch too?

Thanks!

c_archer’s picture

You will need to run the patch manually until the maintainer merges.

c_archer’s picture

StatusFileSize
new1.67 KB

I have updated the patch to take into account the Drupal 10 changes coming to core (https://www.drupal.org/node/3158256).

c_archer’s picture

Status: Reviewed & tested by the community » Needs review
lamp5’s picture

For us #9 does not work, #4 works well.

proweb.ua’s picture

#9
Uncaught SyntaxError: missing ) after argument list
https://prnt.sc/DMBjze5qMnYA

#4 works

anybody’s picture

Status: Needs review » Needs work

Could we please have this as a cleaned up MR with the issue from #9 corrected? (see #12). Thanks!

anybody’s picture

Version: 2.0.0-rc1 » 2.x-dev

Thank you all very much, especially @c_archer!

I'll now commit your fix from #4 and create a new release! We should solve the Drupal 10 changes (once()) in a separate issue.

anybody’s picture

Status: Needs work » Reviewed & tested by the community

  • Anybody committed af29c1e on 2.x
    Issue #3265380 by c_archer, Anybody, johnnydarkko: Uncaught TypeError:...
anybody’s picture

Status: Reviewed & tested by the community » Fixed

Will create a 2.0.0-rc2 release now!

anybody’s picture

Follow-up: #3263563: Remove jQuery dependency in 2.x Please help coding! :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

c_archer’s picture