jpg0 / ohj

Openhab Javascript Library
Eclipse Public License 2.0
6 stars 2 forks source link

Issues after upgrading to OH 2.5.1-2 #3

Closed JamieTemple closed 4 years ago

JamieTemple commented 4 years ago

My scripts have all started to fail to load - which I believe is related to (accidentally) upgrading to OH 2.5.1-2

Everything was working on 2.5.0, then I did an apt upgrade and found myself on 2.5.1-2 and now nothing works :(

I get errors like this loading all of my scripts:

[ERROR] [ript.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/javascript/personal/motion_spare_bedroom.js': org.graalvm.polyglot.PolyglotException: TypeError: Cannot read property 'extend' of undefined

... I've pulled the latest code from here, and also used the zip of graaljs from the other thread.

... I've also tried reverting to the npm build, and the "standard" graaljs jar

help!

jpg0 commented 4 years ago

I haven't tried 2.5.1-2, but I can't see any reason it won't work. I can say that the 'extend' errors that you are getting are due to a mismatch between the plugin version (which doesn't have it in your case) and the JS lib version (which is asking for it).

I really need to setup automatic builds for the plugin so that you can always get the latest version without building it yourself... I'm actually on holiday now so can't build myself either, but I've retrieved the plugin version that I'm currently running from home and attached it here. Please give this one a try!

org.openhab.automation.module.script.graaljs-2.5.0-SNAPSHOT.jar.zip

JamieTemple commented 4 years ago

I haven't tried 2.5.1-2, but I can't see any reason it won't work.

Me neither - in reality, I've done a lot on the linux box that I run OH on, so I can't be sure ... apt upgrade can be v.dangerous in my view!

I can say that the 'extend' errors that you are getting are due to a mismatch between the plugin version (which doesn't have it in your case) and the JS lib version (which is asking for it).

I suspected that might be the case, as you've clearly been continuing development - I just wasn't sure how interdependent the version of graaljs and your library are.

I really need to setup automatic builds for the plugin so that you can always get the latest version without building it yourself... I'm actually on holiday now so can't build myself either, but I've retrieved the plugin version that I'm currently running from home and attached it here. Please give this one a try!

That would be great, but this problem is all down to me really - If I'm going to live on the edge, and go around cloning repos without knowing what's in them, then if it doesn't work, I'm pretty sure that's my fault! ;)

... anyway - everything is back up and running now, working great, so thankyou very much - have a great holiday - hope you're a long way away from any bushfires :)