openhab-vscode icon indicating copy to clipboard operation
openhab-vscode copied to clipboard

Error: Could not get valid data from REST API

Open fwolter opened this issue 4 years ago • 5 comments

I'm getting the following error, when connecting to my openHAB instance, running behind a nginx reverse proxy with Basic Auth and Letsencrypt with redirection to SSL:

Error: Could not get valid data from REST API
    at U._callback (c:\Users\fab\.vscode\extensions\openhab.openhab-0.7.0\serverJS\out\LSPServer.js:135:130206)
    at U.t._callback.t.callback.t.callback (c:\Users\fab\.vscode\extensions\openhab.openhab-0.7.0\serverJS\out\LSPServer.js:195:5603)
    at U.emit (events.js:203:13)
    at U.<anonymous> (c:\Users\fab\.vscode\extensions\openhab.openhab-0.7.0\serverJS\out\LSPServer.js:195:18463)
    at U.emit (events.js:203:13)
    at IncomingMessage.<anonymous> (c:\Users\fab\.vscode\extensions\openhab.openhab-0.7.0\serverJS\out\LSPServer.js:195:17295)
    at Object.onceWrapper (events.js:291:20)
    at IncomingMessage.emit (events.js:208:15)
    at endReadableNT (_stream_readable.js:1168:12)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)

When looking into the TCP stream, I see VSCode gets redirected via port 80 to 443 and then continues encrypted. The connection to the LSP on port 5007 seems to work. Accessing the REST API via browser do work and connecting VSCode to the REST API of my local openHAB instance work, too.

This is my config: grafik

Tried already port 443 or connecting by IP address.

VSCode openHAB 0.7.0 openHAB 2.5.3

fwolter avatar Apr 13 '20 13:04 fwolter

It seems that the local LSP server cant handle the basic auth connection. IT seems to not get dactivated fully, when remote lsp is active.

Reference: https://github.com/openhab/openhab-vscode/blob/master/serverJS/src/ItemCompletion/ItemCompletionProvider.js#L153

This seems like a hardcoded url.

Confectrician avatar Apr 13 '20 18:04 Confectrician

I just wanted to reproduce the error, but now, everything works. I didn't change anything by intention... Observing it.

fwolter avatar Apr 15 '20 19:04 fwolter

Thanks for the Feedback. I have a guess then.

Maybe we have some cached data that caused trouble. I recently read from bug reports which seem to solve themselves. Maybe we should check if we can provide some sort of caching override for settings.

Confectrician avatar Apr 19 '20 17:04 Confectrician

I am faceing the same Problem when i have installed the Amazon Echo Control Binding. When i deinstall it everything works fine. when i reinstall it i am faceing this error

KHOne23 avatar Nov 03 '20 15:11 KHOne23

@Confectrician basically i am facing the same problem, but i can confirm the hard coded URL problem, when adding /rest/items to the openHab.host config, at least the items occur in VS Code, for things i am still getting the error message "Error while connecting to REST API"

heimerle avatar Jan 27 '21 04:01 heimerle