- Issue created by @antcab
Can you post the entire JavaScript stack trace, ideally with JavaScript concatenation disabled, please?
I removed tags based on the issue tag guidelines β .
- πΊπΈUnited States Chris Matthews
Coming from Cannot read properties of undefined (reading 'extend') π Cannot read properties of undefined (reading 'extend') Closed: works as designed , I have this same error, but no JavaScript stack trace is available (to my knowledge). Only the following AJAX error inside a modal popup in my browser window:
An error occurred while attempting to process /form/elder-sage-member-profile?element_parents=elements/photo&ajax_form=1&_wrapper_format=drupal_ajax: Cannot read properties of undefined (reading 'extend')
- πΊπΈUnited States Chris Matthews
You may have to set breakpoints in ajax.js and work backward.
I'm "just" a site builder primarily, so I really have no idea how to accomplish this.
So is this a Core issue? A Webform issue? Or a Bootstrap 3 issue? It would be great to have steps to reproduce on a newly-installed site.
- πΊπΈUnited States Chris Matthews
Looks like it's a Bootstrap 3 β issue, and it's very easy to reproduce:
Install Drupal 10.0.5
Install Bootstrap 8.x-3.27
Edit permissions to allow Anonymous user to create Article nodes
As an Anonymous user, create an article node /node/add/article
Try to upload an image to the Image field
Notice errorAn error occurred while attempting to process /node/add/article?element_parents=field_image/widget/0&ajax_form=1&_wrapper_format=drupal_ajax: _ is undefined
Live example: https://dev-ajax-error.pantheonsite.io/node/add/article
- πͺπΈSpain antcab
Yes, that is exactly the error I have, an AJAX error inside a modal popup in the browser.
An error occurred while attempting to process /node/add/article?element_parents=field_image/widget/0&ajax_form=1&_wrapper_format=drupal_ajax: Cannot read properties of undefined (reading 'extend')
With administrator user, theres is no problem. Only when users has another role: authenticated user, anonymous user
Thanks
The issue is that the bootstrap theme has libraries dependent on underscore: https://git.drupalcode.org/project/bootstrap/-/blob/8.x-3.x/bootstrap.libraries.yml#L6
attributes: js: js/attributes.js: {} dependencies: - core/jquery - core/underscore
Underscore has been removed from core in Drupal 10: Underscore library is deprecated β
Separately, and while I don't think it has to do with this specific problem, there are other dependencies on core libraries that have been removed, namely the jquery.ui ones: https://git.drupalcode.org/project/bootstrap/-/blob/8.x-3.x/bootstrap.libraries.yml#L73
modal.jquery.ui.bridge: js: js/modal.jquery.ui.bridge.js: {} dependencies: - bootstrap/modal - core/jquery.ui - core/jquery.ui.widget - core/jquery.ui.draggable - core/jquery.ui.mouse - core/jquery.ui.position - core/jquery.ui.resizable
- πΊπΈUnited States Chris Matthews
@godotislate, thanks for the insight. If anyone is interested, our nonprofit is happy to sponsor the time necessary to create a patch that will update the bootstrap theme codebase and dependencies to fix this issue that prevents Anonymous and Authenticated users from uploading images to core fields, as well as on Webforms with the ' 'Image file' element.
Looks like this is actually a dupe of π Underscore.js library is deprecated under Drupal 10, quick dependencies fix Fixed .
There's an MR there with a quick fix.
Note it's a temporary fix because core will eventually remove the
core/internal.underscore
library as well. Long term replacement issue: π Underscore.js library deprecation in Drupal's core Active .- Status changed to Closed: duplicate
over 1 year ago 8:08pm 30 March 2023 - πΊπΈUnited States Chris Matthews
Thanks godotislate, I applied the patch from the merge request in Issue #3343708 π Underscore.js library is deprecated under Drupal 10, quick dependencies fix Fixed and after manually testing it did fix this issue. Closing this issue as a duplicate and will respond over at 3343708
- πΊπΈUnited States Chris Matthews
Here is a patch that includes jquery dependency updates as well:
THISmodal.jquery.ui.bridge: js/modal.jquery.ui.bridge.js: {} dependencies: - bootstrap/modal - core/jquery.ui - core/jquery.ui.widget - core/jquery.ui.draggable - core/jquery.ui.mouse - core/jquery.ui.position - core/jquery.ui.resizable
TO THIS
modal.jquery.ui.bridge: js/modal.jquery.ui.bridge.js: {} dependencies: - jquery_ui/jquery_ui - jquery_ui_draggable/jquery_ui_draggable - jquery_ui_resizable/jquery_ui_resizable