# Require('uxp').host; generating error with InDesign v19.0

**URL:** <https://forums.creativeclouddeveloper.com/t/require-uxp-host-generating-error-with-indesign-v19-0/6641>\
**Category:** InDesign\
**Created:** [August 7, 2023, 3:41pm UTC](https://forums.creativeclouddeveloper.com/t/require-uxp-host-generating-error-with-indesign-v19-0/6641 "2023-08-07T15:41:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![medium\_jon](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/medium_jon/32/2371_2.png) [@medium\_jon](https://forums.creativeclouddeveloper.com/u/medium_jon)\
**Post date:** [August 7, 2023, 3:41pm UTC](https://forums.creativeclouddeveloper.com/t/require-uxp-host-generating-error-with-indesign-v19-0/6641/1 "2023-08-07T15:41:51Z")

</div>

The following line errors in a UXP based plug-in loaded in InDesign version 19.0 (Mainline Cl #d0cd1dc)

`const g_host_o = require('uxp').host;`

UDT version 1.9 reports this:

​ Uncaught TypeError: Cannot read properties of undefined (reading ‘on’)  
at new (uxp://uxp-internal/pluginmanager\_scripts.js:2)  
at Object. (uxp://uxp-internal/pluginmanager\_scripts.js:2)  
at n (uxp://uxp-internal/pluginmanager\_scripts.js:2)  
at e.exports. (uxp://uxp-internal/pluginmanager\_scripts.js:2)  
at uxp://uxp-internal/pluginmanager\_scripts.js:2  
at Object.get (uxp://uxp-internal/pluginmanager\_scripts.js:2)  
at VM11 idClientMain.js:31  
at e.exports.execScript (uxp://uxp-internal/domjs\_scripts.js:2)  
at l (uxp://uxp-internal/domjs\_scripts.js:2)  
at uxp://uxp-internal/domjs\_scripts.js:2

In version 18.5 there are no problems with it.

Did I miss something about `.host` in

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [August 7, 2023, 7:21pm UTC](https://forums.creativeclouddeveloper.com/t/require-uxp-host-generating-error-with-indesign-v19-0/6641/2 "2023-08-07T19:21:33Z")

</div>

Based on the error, that’s not the line. Search for `.on`

---

<div class="post-metadata">

**Author:** ![medium\_jon](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/medium_jon/32/2371_2.png) [@medium\_jon](https://forums.creativeclouddeveloper.com/u/medium_jon)\
**Post date:** [August 7, 2023, 8:56pm UTC](https://forums.creativeclouddeveloper.com/t/require-uxp-host-generating-error-with-indesign-v19-0/6641/3 "2023-08-07T20:56:24Z")

</div>

Thanks for looking, Zuri.  
I did check the entire codebase and there were no `.on` as a whole word. Closest I got was some:

- `.onclick`
- `.onchange`
- `.ondblclick`

The error stack shows `at VM11 idClientMain.js:31` which is the line where, at the time, I had that `require('uxp').host;` line. Everything above that point in the stack is all `uxp-internal/pluginmanager_scripts.js`

I can do the `require('uxp')` just fine. But if I attempt to then use that with something like this:  
`var u = require('uxp');`  
`var h = u.host;` then this line would error same as the reported one. Either way works fine with Adobe Photoshop (24 and 25), and Adobe InDesign 18.5 just not Adobe InDesign 19.

jsw

---

<div class="post-metadata">

**Author:** ![Sujai](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/sujai/32/2791_2.png) [@Sujai](https://forums.creativeclouddeveloper.com/u/Sujai)\
**Post date:** [August 9, 2023, 4:16pm UTC](https://forums.creativeclouddeveloper.com/t/require-uxp-host-generating-error-with-indesign-v19-0/6641/4 "2023-08-09T16:16:18Z")

</div>

@medium_jon Will get back on this. Ideally should be fixed by InDesign 19.0 release.

---

<div class="post-metadata">

**Author:** ![medium\_jon](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/medium_jon/32/2371_2.png) [@medium\_jon](https://forums.creativeclouddeveloper.com/u/medium_jon)\
**Post date:** [August 10, 2023, 12:28pm UTC](https://forums.creativeclouddeveloper.com/t/require-uxp-host-generating-error-with-indesign-v19-0/6641/5 "2023-08-10T12:28:09Z")

</div>

Thanks @Sujai!

From discussions during an online chat, it appears that `.host` is not provided currently in InDesign v19 prerelease and that it should be by the time the release version of 19.0 reaches `ga` status.

I’ll just develop using v18.5 until the 19 `ga` is available.

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [August 10, 2023, 12:30pm UTC](https://forums.creativeclouddeveloper.com/t/require-uxp-host-generating-error-with-indesign-v19-0/6641/6 "2023-08-10T12:30:29Z")

</div>

I think error should also be fixed then 🤔

```auto
Cannot read properties of undefined (reading ‘on’) at new (uxp://uxp-internal/pluginmanager_scripts.js:2)

```

This doesn’t make sense in this case
