openhab / openhab-webui

Web UIs of openHAB
Eclipse Public License 2.0
212 stars 232 forks source link

After update to OH4 item selector is not working anymore (Uncaught (in promise) parseerror) #2258

Closed boehla closed 4 months ago

boehla commented 4 months ago

The problem

Recently updated from Openhab 3.3.0 to 4.1.0. Worked pretty straightforward. But now I wanted to edit a Label on a Page, but the item selector popup is not working anymore:

image When I click nothing happens. (also no additional error added in console)

Edit the page in textmode is working.

Is it because of the weird error in the console? "Uncaught (in promise) parseerror" What does this error means??

Same thing for "Items to Analyze" popup.

In the log viewer I don't see any (related) error.

Expected behavior

Item selector popup should open.

Steps to reproduce

I could reproduce the problem with an empty page.

Your environment

runtimeInfo:
  version: 4.1.0
  buildString: Release Build
locale: en-AT
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 17.0.9
  javaVendor: Private Build
  osName: Linux
  osVersion: 5.4.0-169-generic
  osArchitecture: amd64
  availableProcessors: 2
  freeMemory: 226458816
  totalMemory: 717225984
  uptime: 1384
  startLevel: 70
addons:
  - automation-jsscripting
  - automation-pidcontroller
  - binding-astro
  - binding-daikin
  - binding-deconz
  - binding-fronius
  - binding-goecharger
  - binding-http
  - binding-modbus
  - binding-mqtt
  - binding-network
  - binding-shelly
  - binding-snmp
  - persistence-rrd4j
  - transformation-jsonpath
  - transformation-map
  - ui-basic
  - ui-habpanel
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: true
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    os: windows
    pixelRatio: 1
    prefersColorScheme: light
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 16
    language: en-US
    languages:
      - en-US
      - de-AT
      - de
      - en-AT
      - it-IT
      - it
      - sv-SE
      - sv
      - en
    onLine: true
    platform: Win32
  screen:
    width: 1920
    height: 1080
    colorDepth: 24
  support:
    touch: false
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
  themeOptions:
    dark: dark
    filled: true
    pageTransitionAnimation: default
    bars: light
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
    like Gecko) Chrome/120.0.0.0 Safari/537.36
timestamp: 2024-01-07T06:30:55.965Z
florian-h05 commented 4 months ago

From the information provided, it is really difficult to debug that and I cannot reproduce this on my installation. Can you please check the network tab and show me the response of any request to /rest/items?

I could imagine (just guessing) that this is caused by the Firefox caching issue, which I have already created a fix. Today openHAB 4.1.1 is planned to be released, which will also include my fix for the Firefox caching issue, so probably recheck after upgrading to 4.1.1.

boehla commented 4 months ago

Many thanks for the reply, helps me already a lot. Looks like somehow the json response of /rest/items is broken. At the beginning its fine, but it looks like the ending is overwritten with another (error) json:

...{"link":"http://10.0.1.131:8080/rest/items/cellar_battery_level","state":"99","stateDescription":{"step":1.0,"pattern":"%.1f %%","readOnly":true,"options":[]},"unitSymbol":"one","editable":false,"type":"Number:Dimensionless","name":"cellar_battery_level","label":"Cellar Battery","category":"humidity","tags":[],"groupNames":[]},{"link":"http://10.0.1.131:8080/rest/items/seplos1_lastupdate","state":"2024-01-07T13:51:23.747715763+0100","stateDescription":{"pattern":"%1$tm/%1$td %1$tH:%1$tM","readOnly":false,"options":[]},"editable":false,"type":"DateTime","name""{\"error\":{\"http-code\":500,\"exception\":{\"class\":\"java.lang.ClassCastException\"}}}"

Everytime I do the request again it looks a bit different:

...{"link":"http://10.0.1.131:8080/rest/items/cellar_battery_level","state":"99","stateDescription":{"step":1.0,"pattern":"%.1f %%","readOnly":true,"options":[]},"unitSymbol":"one","editable":false,"type":"Number:Dimensionless","name":"cellar_battery_level","label":"Cellar Battery","category":"humidity","tags":[],"groupNames":[]},{"link":"http://10.0.1.131:8080/rest/items/seplos1_lastupdate","state":"2024-01-07T13:55:53.841912053+0100","stateDescription":{"pattern":"%1$tm/%1$td %1$tH:%1$tM","readOnly":false,"options"{\"error\":{\"http-code\":500,\"exception\":{\"class\":\"java.lang.ClassCastException\"}}}"

In the logviewer I see this:

2024-01-07 13:55:54.657 [ERROR] [rg.apache.cxf.jaxrs.utils.JAXRSUtils] - Problem with writing the data, class org.openhab.core.io.rest.Stream2JSONInputStream, ContentType: application/json

2024-01-07 13:55:54.658 [ERROR] [internal.JSONResponseExceptionMapper] - Unexpected exception occurred while processing REST request.

java.lang.ClassCastException: null

There should be no caching issue, tried it with "disable cache", firefox and edge.

boehla commented 4 months ago

Wtf, I could resolve the problem... I only had to deactivate one thing: Shelly RGBW2 (LED Controller in Color Mode)