Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ERROR: multiple element <head> occourences are not supported (found 2 occourences) #624

Open
adixon opened this issue Dec 5, 2023 · 7 comments

Comments

@adixon
Copy link

adixon commented Dec 5, 2023

  1. Drupal 10.1.6 + CiviCRM 5.65.0
  2. Drupal is multilingual with path prefix
  3. Mosiaco upgraded to 3.3.1697392242

New mailings using versafix-1 are okay.
New mailings using one of the other custom templates based on versafix give the error in the console:

Uncaught ERROR: multiple element <head> occourences are not supported (found 2 occourences)

Found in the file: /sites/default/files/civicrm/ext/uk.co.vedaconsulting.mosaico/packages/mosaico/dist/rs/src/js/template-loader.js

I can create new templates from versafix, but when trying to edit them and any other custom template based on versafix, I get the same error above.

I reviewed the entry in civicrm_mosaico_template and the html doesn't have multiple values in the html, it has exactly one.

So I suspect the js error is misleading, and I'm going to hazard a guess that it's related to the path prefix thingy (but only due to recency bias on my part).

We did disable a few mosaico extensions (tweaks and message templates), the error continues.

@adixon
Copy link
Author

adixon commented Dec 5, 2023

Perhaps this is the same issues as this one: #622

@KarinG
Copy link

KarinG commented Dec 6, 2023

Screenshot -> when selecting an existing template:

image

@KarinG
Copy link

KarinG commented Dec 6, 2023

I don't believe there is a file named template-loader.js in 3.3 (neither on this client side; nor on a freshly downloaded 3.3 from https://civicrm.org/extensions/email-template-builder)

I can find other files:
karins-MBP:uk.co.vedaconsulting.mosaico sysadmin$ find . -name mosaico.min.js
./packages/mosaico/dist/rs/mosaico.min.js

Not this one:
karins-MBP:uk.co.vedaconsulting.mosaico sysadmin$ find . -name template-loader.js
karins-MBP:uk.co.vedaconsulting.mosaico sysadmin$

@adixon
Copy link
Author

adixon commented Dec 6, 2023

Yes, see the related issue I linked above, in that case they were resolved it by trying a different browser!

Trying to access the file via https similarly fails (i.e., not a server caching issue).

@KarinG
Copy link

KarinG commented Dec 6, 2023

Using a completely different browser does not make any difference in this case -> Safari:

image

template-loader.js is not a file on a freshly installed version of Mosaico on my local instance either.

Checking a (third) completely different project that has a functioning Mosaico: that template-loader.js file does not exist either.
root@5cf31e9a5401:/var/www/drupal/web/sites/default/files/civicrm/ext/uk.co.vedaconsulting.mosaico# find . -name template-loader.js
root@5cf31e9a5401:/var/www/drupal/web/sites/default/files/civicrm/ext/uk.co.vedaconsulting.mosaico#

Why are we looking for this file? :-)

@adixon
Copy link
Author

adixon commented Dec 6, 2023

Yes, that's the question. Or rather, how the heck is a non-existent file not only being referenced, but also loaded (as seen in the javascript console) and generating errors?

The referenced issue suggested that it might be related to browser caching after an upgrade, but then again maybe not (as per your post).

In any case, presumably this is all connected to the fact that the extension is now using an updated version of the upstream mosaico project.

Conclusion: WTF?!

@demeritcowboy
Copy link

The template-loader.js seems to be bundled and minified into mosaico-libs-and-tinymce.min.js, and it may or may not be adding a problem, but there is a separate problem before that. I'll post on #567 since that seems the closest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants