Plugin doesn't work if installed when Photoshop is not launched

I have trying to push new update plugin and jumped on issue. If I try to install plugin via CC directly of by clicking ccx, and if Photoshop is not launched. PLugin is installed, however, when I launch Photoshop and go to plugin, it doesn’t work and doesnt execute any command.

If I install plugin, when Photoshop is open, then plugin works.

  "main": "index.js",
  "host": [
    {
      "app": "PS",
      "minVersion": "22.0.0"
    }
  ],
  "manifestVersion": 4,
  "entrypoints": [
    {
      "type": "command",
      "id": "auth",
      "label": {
        "default": "Sign In / Sign Out"
      }
    }
  ],

UXP app logs shows error when I click on any command. However cannot find anything related with length.

[2024-05-13 14:07:50:671] [console] Unhandled promise rejection TypeError: Cannot read properties of undefined (reading 'length')

Using Adobe Photoshop 2024 (25.7.0)

Has anyone experience similar case?

Try

  "host": {
    "app": "PS",
    "minVersion": "22.0.0"
  },

Nop, that didn’t helped.

If I add empty panel and trigger it first in PS, then commands also start working.

I see what you mean now. Check load event

  "host": {
    "app": "PS",
    "minVersion": "23.1.0",
    "data" : {
      "apiVersion": 2,
      "loadEvent": "startup"
    }
  },

@donatasp, did that help?

With apiVersion 2 I had another issue: Quick Export as PNG is not working anymore and couldn’t find solution for that.

However I have migrated all commands to panel as actions and it works in apiVersion: 1.

Thanks for help.