# On Click calling \_ember\_jquery at wrong path

**URL:** https://meta.discourse.org/t/on-click-calling-ember-jquery-at-wrong-path/138573
**Category:** Support
**Created:** [January 14, 2020, 4:55pm UTC](https://meta.discourse.org/t/on-click-calling-ember-jquery-at-wrong-path/138573 "2020-01-14T16:55:58Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ankur-p](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ankur-p/32/166491_2.png) [@ankur-p](https://meta.discourse.org/u/ankur-p)
#### Post date: [January 14, 2020, 4:55pm UTC](https://meta.discourse.org/t/on-click-calling-ember-jquery-at-wrong-path/138573/1 "2020-01-14T16:55:58Z")

</div>

I’ve been debugging an issue I’m having with BS4 dropdowns not working and found that on click, \_ember\_jquery.js is being called at /assets/var/www/discourse/public/assets instead of at /assets (which is where it is actually located). Not sure why the full server path is being appended. To my knowledge, no relevant config changes have been made, and the only thing I’ve been working on is adding a simple, custom plugin (yes, the problem persists even with the plugin removed). I’m fairly new to Discourse, so any thoughts on the matter would be greatly appreciated. Please let me know if you need any additional info.

---

<div class="post-metadata">

### Author: ![bdeter](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bdeter/32/143587_2.png) [@bdeter](https://meta.discourse.org/u/bdeter)
#### Post date: [January 16, 2020, 4:25pm UTC](https://meta.discourse.org/t/on-click-calling-ember-jquery-at-wrong-path/138573/2 "2020-01-16T16:25:02Z")

</div>

I believe this is a problem with the way the source map is being generated, caused by this PR: [DEV: Bump uglifyjs by romanrizzi · Pull Request #7834 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/7834).

Previously, the -p relative option was used so source map paths looked like [‘admin…js.map’]. Starting with 2.4.beta9, the -p option is not available because of the change to uglify 3, so source map paths were absolute like [‘/var/www/discourse/public/assets/admin…js.map’]. This caused the source maps to 404 when debugging since the actual file was at /assets, but the map indicated it was at /var/www/…/assets.

A workaround I found was to change lib/tasks/asset.rake to add the base option to the source map parameter so it looks like this:

```plaintext
  base = assets_path + ((d = File.dirname(from)) == "." ? "" : "/#{d}")

  cmd = <<~EOS
    uglifyjs '#{assets_path}/#{from}' -m -c -o '#{to_path}' --source-map "base='#{base}',root='#{source_map_root}',url='#{source_map_url}'" --output '#{to_path}'
  EOS

```

I can’t guarantee it would work for everyone, but it allows me to debug via source maps without the 404 errors.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 17, 2020, 2:58pm UTC](https://meta.discourse.org/t/on-click-calling-ember-jquery-at-wrong-path/138573/3 "2020-01-17T14:58:11Z")

</div>

Did we need to fix this @sam?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 20, 2020, 12:56am UTC](https://meta.discourse.org/t/on-click-calling-ember-jquery-at-wrong-path/138573/4 "2020-01-20T00:56:32Z")

</div>

Yeah we are tracking this elsewhere, will add a note on the TODO so @Roman is aware.

---

<div class="post-metadata">

### Author: ![Roman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roman/32/157504_2.png) [@Roman](https://meta.discourse.org/u/Roman)
#### Post date: [January 24, 2020, 7:04pm UTC](https://meta.discourse.org/t/on-click-calling-ember-jquery-at-wrong-path/138573/6 "2020-01-24T19:04:46Z")

</div>

Sorry for the delay, the issue is now fixed and backported to beta and stable. I added the `base` attribute, which contains the path to the asset, leaving the source attribute with only the filename.

[https://review.discourse.org/t/fix-ensure-sourcemaps-source-is-correct-uses-the-full-assets-path-this-time-8774/8506](https://review.discourse.org/t/fix-ensure-sourcemaps-source-is-correct-uses-the-full-assets-path-this-time-8774/8506)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [December 9, 2023, 12:54am UTC](https://meta.discourse.org/t/on-click-calling-ember-jquery-at-wrong-path/138573/7 "2023-12-09T00:54:22Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [December 9, 2023, 1:44am UTC](https://meta.discourse.org/t/on-click-calling-ember-jquery-at-wrong-path/138573/8 "2023-12-09T01:44:02Z")

</div>


