# \[BUG\] \[CRITICAL\] UserInfo.userId() does not always return a value

**URL:** <https://forums.creativeclouddeveloper.com/t/bug-critical-userinfo-userid-does-not-always-return-a-value/9544>\
**Category:** UXP Plugin API\
**Tags:** bug, uxp, javascript\
**Created:** [February 22, 2025, 11:05am UTC](https://forums.creativeclouddeveloper.com/t/bug-critical-userinfo-userid-does-not-always-return-a-value/9544 "2025-02-22T11:05:10Z")\
**Posts on this page:** 5\
**Page:** 1

<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:** [February 22, 2025, 11:05am UTC](https://forums.creativeclouddeveloper.com/t/bug-critical-userinfo-userid-does-not-always-return-a-value/9544/1 "2025-02-22T11:05:10Z")

</div>

In my index file, right after `entrypoints.setup()` I perform some checks and it’s using:

```auto
import { userInfo } from "uxp"

const userId = userInfo.userId()

```

Very (and I mean VERY) often `userInfo.userId()` returns just an empty value. Don’t know if it’s `null` or `undefined` or just empty string, but it evaluates to empty string. I spent 3 days debugging this and the only way I could pin point to this, was by adding logging to file and restart Ps a bunch of times (usually up to 10 is enough) to find this empty. Could never reproduce when loaded via UXP Dev Tools (because plugin unloads when Ps is closed), so had to actually install CCX via CCD app

* * *

Some context… My license activations are validated against OS data and this user ID. At the end I have a string similar to:

```auto
// `${some_os_data}_{userInfo.userId()}`
const validateString = "16_win32_x64_OSUsername_abcde0123456789"

```

And with my logging enabled I usually get this string logged as expected, but quite often it’s just:

```auto
const validateString = "16_win32_x64_OSUsername_"

```

---

<div class="post-metadata">

**Author:** ![ismail3762](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/ismail3762/32/4333_2.png) [@ismail3762](https://forums.creativeclouddeveloper.com/u/ismail3762)\
**Post date:** [February 22, 2025, 7:46pm UTC](https://forums.creativeclouddeveloper.com/t/bug-critical-userinfo-userid-does-not-always-return-a-value/9544/2 "2025-02-22T19:46:42Z")

</div>

If you’re using CommonJS to invoke `userId()`, try switching to ES modules it might improve retrieval speed. I used to get the same error, because I preform a network request that contains the userId when plugin first loads. Since switching to ES modules, everything has been working smoothly.

---

<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:** [February 22, 2025, 8:05pm UTC](https://forums.creativeclouddeveloper.com/t/bug-critical-userinfo-userid-does-not-always-return-a-value/9544/3 "2025-02-22T20:05:41Z")

</div>

I don’t think I can easily switch to ES Modules now, but not sure… I’d need to check that, because everywhere in my cone I use `export/import`, which I believe is ES module way, but in `tsconfig` I have

```auto
{
  "compilerOptions": {
    "target": "es6",
    "jsx": "preserve",
    "module": "commonjs",
    "moduleResolution": "node",

```

Just switching it there, ends up in a bunch of errors.

In any case, I think that’s still abug 😕

---

<div class="post-metadata">

**Author:** ![ryanthornburg](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@ryanthornburg](https://forums.creativeclouddeveloper.com/u/ryanthornburg)\
**Post date:** [February 23, 2025, 12:56am UTC](https://forums.creativeclouddeveloper.com/t/bug-critical-userinfo-userid-does-not-always-return-a-value/9544/4 "2025-02-23T00:56:59Z")

</div>

So I had this issue, exactly as you describe (uxp tool vs loading plugin) and realized it wasn’t available when my plugin first loads. I just do a check if userId exists and if not, reload until it does.

It’s definitely not an ideal solution, but it helped me.

---

<div class="post-metadata">

**Author:** ![Dirk](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@Dirk](https://forums.creativeclouddeveloper.com/u/Dirk)\
**Post date:** [February 23, 2025, 6:34am UTC](https://forums.creativeclouddeveloper.com/t/bug-critical-userinfo-userid-does-not-always-return-a-value/9544/5 "2025-02-23T06:34:07Z")

</div>

I had similar troubles with ExtendScript accessing InDesign’s app.userAdobeId during startup. First observed with version 19 aka 2024. The license activation may have been turned into a background task or kicks in later than in older versions.

There also have been reports about the related GUID being not distinct in school lab scenarios. I don’t know what that means for the user ID, but better prepare a timeout and some UI.
