vert-x / mod-lang-clojure

Vert.x 2.x is deprecated - use instead
http://vertx.io
Other
74 stars 15 forks source link

New upstream deps causes SockJS to not be found #123

Closed jacobemcken closed 10 years ago

jacobemcken commented 10 years ago

I've updated clojure, clojurescript and vertx api to latest stable which have caused issues before, but which I expected to have been solved.

Here is my "test case": https://github.com/jacobemcken/simple-immutant-vertx-demo/compare/new_upstream_causes_breakage

I've tried to build both with and without specifying foreign-libs (see the cljs build profiles):

lein cljsbuild clean
lein cljsbuild once with
# test application

lein cljsbuild clean
lein cljsbuild once without
# test application

Both of the above compiles giving only warnings:

Compiling ClojureScript.
Compiling "resources/public/client.js" from ["src-cljs"]...
Upstream deps.cljs found on classpath. {:foreign-libs [{:file "js/vertxbus.js", :provides ["vertx.eventbusjs"]} {:file "js/sockjs.js", :provides ["sockjs"]}]} This is an EXPERIMENTAL FEATURE and is not guarenteed to remain stable in future versions.
WARNING: clone already refers to: /clone being replaced by: domina/clone at line 148 file:/home/je/.m2/repository/domina/domina/1.0.1/domina-1.0.1.jar!/domina.cljs
WARNING: No such namespace: XPathResult at line 30 file:/home/je/.m2/repository/domina/domina/1.0.1/domina-1.0.1.jar!/domina/xpath.cljs
WARNING: No such namespace: XPathResult at line 41 file:/home/je/.m2/repository/domina/domina/1.0.1/domina-1.0.1.jar!/domina/xpath.cljs
WARNING: Use of undeclared Var enfocus.core/Utility at line 36 file:/home/je/.m2/repository/enfocus/enfocus/2.0.0-beta1/enfocus-2.0.0-beta1.jar!/enfocus/core.cljs
WARNING: Use of undeclared Var enfocus.core/functions at line 36 file:/home/je/.m2/repository/enfocus/enfocus/2.0.0-beta1/enfocus-2.0.0-beta1.jar!/enfocus/core.cljs
WARNING: No such namespace: goog.net.EventType at line 172 file:/home/je/.m2/repository/enfocus/enfocus/2.0.0-beta1/enfocus-2.0.0-beta1.jar!/enfocus/core.cljs
WARNING: Extending an existing JavaScript type - use a different symbol name instead of js/String e.g string at line 690 file:/home/je/.m2/repository/enfocus/enfocus/2.0.0-beta1/enfocus-2.0.0-beta1.jar!/enfocus/core.cljs
WARNING: Use of undeclared Var enfocus.core/Utility at line 36 /home/je/Projects/simple-immutant-vertx-demo/target/cljsbuild-compiler-1/enfocus/core.cljs
WARNING: Use of undeclared Var enfocus.core/functions at line 36 /home/je/Projects/simple-immutant-vertx-demo/target/cljsbuild-compiler-1/enfocus/core.cljs
WARNING: No such namespace: goog.net.EventType at line 172 /home/je/Projects/simple-immutant-vertx-demo/target/cljsbuild-compiler-1/enfocus/core.cljs
WARNING: Extending an existing JavaScript type - use a different symbol name instead of js/String e.g string at line 690 /home/je/Projects/simple-immutant-vertx-demo/target/cljsbuild-compiler-1/enfocus/core.cljs
WARNING: No such namespace: XPathResult at line 30 /home/je/Projects/simple-immutant-vertx-demo/target/cljsbuild-compiler-1/domina/xpath.cljs
WARNING: No such namespace: XPathResult at line 41 /home/je/Projects/simple-immutant-vertx-demo/target/cljsbuild-compiler-1/domina/xpath.cljs
WARNING: clone already refers to: /clone being replaced by: domina/clone at line 148 /home/je/Projects/simple-immutant-vertx-demo/target/cljsbuild-compiler-1/domina.cljs

But gives the following error in the browser console (using Firefox):

ReferenceError: SockJS is not defined
    factory(SockJS);
tobias commented 10 years ago

This is a different issue than CLJS-798 - the foreign-libs from deps.clj are being included & compiled, but it appears they may be ending up in the compiled js in the wrong order. I'll have to dig deeper to see.

jacobemcken commented 10 years ago

Awww :cry: that is bad news. We have a branch with code depending on a newer ClojureScript (using Om and Kioo among other things). But it doesn't want to play ball with the websocket thingie. If this isn't (easily) solvable - I will evaluate The Duce alpha/snapshot as an alternative.

I'll be looking forward to your next mod-lang-clojure status and if all else fails your WS tuts for The Duce :smile:

tobias commented 10 years ago

I've tracked it down to a change in vertxbus.js that now expects SockJS to already be loaded, and that expectation holds when they are compiled in to client.js. I have a potential workaround that I'll test tonight or in the AM. If that works, I'll cut a mod-lang-clojure release ASAP for you.

tobias commented 10 years ago

I believe I've fixed this in master, and have pushed a 1.0.3-SNAPSHOT with the fix. Can you give that a try?

I also pushed a branch of the demo app that has the minimum changes I had to make to get it to work: https://github.com/immutant/simple-immutant-vertx-demo/commit/6527a86a2f4d7733cf73fd0d7e392bb74217c9c5 (that doesn't include an updated client.js, you'll need to lein cljsbuild once to get that).

Note that I had to update enfocus as well, since the older version does not work with the latest cljs.

If this works for you, I'll get the ball rolling to get a release out tomorrow.

jacobemcken commented 10 years ago

I've tested 1.0.3-SNAPSHOT in our branch and it is working and WebSockets is working. Our application doesn't work as before (using 1.0.0.Beta1) but I'm confident that it is something we can fix ourselves :)

Perhaps you have some insight?... before when we pushed #joda/datetime "2014-08-28T09:07:17.367Z" over the bus something in mod-lang-clojure or Vertx converted this to a string, now it just throws a:

Cannot put objects of class class org.joda.time.DateTime in JsonObject

We can do the converting manually no problem... would you know of a way to enable to old behavior for now?

Thanks for all your help I think you can close the issue.

tobias commented 10 years ago

I've released 1.0.3, and it should be available in maven central sometime tonight.

jacobemcken commented 10 years ago

thanks I got it all working with this new release