What is the right approach to debugging the pestestal.io application?

I'm currently trying to redefine the todo example application to understand how it works, and I get an error when loading the page, I am not sure how to go from here. My concern is that the error is in cljs.core .

 todo-app.simulated.services.receive_messages = (function receive_messages(app){ return io.pedestal.app.protocols.put_message.call(null,(new cljs.core.Keyword("\uFDD0:input")).call(null,app),cljs.core.PersistentArrayMap.fromArray([io.pedestal.app.messages.type,"\uFDD0:create-todo",io.pedestal.app.messages.topic,cljs.core.PersistentVector.fromArray(["\uFDD0:todo"], true)], true)); }); 

Exception Message:

 Uncaught TypeError: Object function (meta,cnt,arr,__hash){ this.meta = meta; this.cnt = cnt; this.arr = arr; this.__hash = __hash; this.cljs$lang$protocol_mask$partition1$ = 4; this.cljs$lang$protocol_mask$partition0$ = 16123663; } has no method 'fromArray' 

And my dependencies:

 [[org.clojure/clojure "1.5.1"] [org.clojure/clojurescript "0.0-1820"] [domina "1.0.1"] [ch.qos.logback/logback-classic "1.0.7" :exclusions [org.slf4j/slf4j-api]] [io.pedestal/pedestal.app "0.1.9"] [io.pedestal/pedestal.app-tools "0.1.9"]] 

Any help or understanding will be appreciated!

+4
source share
2 answers

I also saw this error, and it seemed that it came out of nowhere. Cleaning out/ dir ( :target-path in your project.clj ) fixed it for me. Based on this, I think that during the compilation of cljs and / or the pedestal there was some disconnection.

This problem looks similar and the fix was similar, so I assume it is a cljs build problem.

I have nothing to offer regarding debugging the pedestal in general, but if I see an error that seems to be in the main library, I proceed from the assumption that something is wrong on my part. :)

EDIT

With a little more information, it is recommended that you delete the out\ directory with every update to ClojureScript or the pedestal.

+1
source

As shown in bostonou , the best approach is to remove the out directory. My current approach is to use lein-cljsbuild , I personally do this by adding it to my user profile.

You can do this by calling nano ~/.lein/profiles.clj

Currently, the mine is as follows:

 {:user {:plugins [[lein-difftest "2.0.0"] [lein-marginalia "0.7.1"] [lein-pprint "1.1.1"] [lein-swank "1.4.4"] [lein-catnip "0.5.1"] [environ/environ.lein "0.3.0"] [lein-cljsbuild "0.3.2"]] :hooks [environ.leiningen.hooks]}} 

Now you can automatically create cljs files by calling lein-cljsbuild once inside the project folder. Calling lein-cljsbuild auto ensures that when you edit the source files, they are automatically compiled.

I am currently adding :hooks [leiningen.cljsbuild] to my project.clj so that calling lein clean also lein clean files created by lein-cljsbuild .

+1
source

Source: https://habr.com/ru/post/1487420/


All Articles