Fork me on GitHub
#clojurescript
<
2017-10-01
>
jmb00:10:21

Hey guys. I deployed my Reagent app to Heroku. I'm getting a 500 error that says "No implementation of method: :to-uri of protocol: #'hiccup.util/ToURI found for class: nil". What's this error supposed to mean?

au-phiware00:10:26

I'm not sure... can you provide some more context? a code snippet?

au-phiware00:10:06

the method is to-uri not :to-uri... or perhaps you're expecting a map and getting a nil

jmb01:10:21

I'll send a picture in a bit, but it works fine in development. It seems to be complaining now that it's in production

au-phiware01:10:32

hmmm, so something has gone wrong when calling include-css? are you missing a css file on the server?

au-phiware01:10:52

(I'm stabbing in the dark here...)

jmb01:10:19

Yeah I had that problem earlier and the deployment kept getting rejected. I fixed that problem which made my deployment successful. Now I have this new problem that says there's no implementation of to-uri for the protocol ToURI. I tried fixing it by requiring hiccup.util inside my handler.clj file but that didn't work

au-phiware01:10:44

to me the error message says that it can't call to-uri on nil, not that hiccup.util is missing

au-phiware01:10:12

perhaps there's a path that's misconfigured which is causing a file not to be found?

au-phiware01:10:07

in other words, hiccup.util is trying to make an uri from a value that's in your config (or env vars) but that piece of config has not been set and the value is nil (still stabbing in the dark, can you provide a code snippet?)

jmb01:10:53

I just moved it to prod/clj/lazyfit/middleware.clj

jmb01:10:58

(ns lazyfit.middleware (:require [ring.middleware.defaults :refer [site-defaults wrap-defaults]] [hiccup.util :refer :all])) (defn wrap-middleware [handler] (wrap-defaults handler site-defaults))

au-phiware01:10:36

not sure if that snippet of code is the problem... what about the hiccup data that it's trying to process?

au-phiware01:10:54

or lazyfit.handler/loading-page?

jmb01:10:53

That's my whole handler.clj file

au-phiware01:10:33

yep, so line 20 looks suspect

jmb01:10:04

omg yeah I just saw that literally right now. I'm redeploying it now and will see if that works

jmb01:10:09

Holy crap it works! Unbelievable smh. I can't believe it was that simple of an error. Thank you so much @au-phiware

au-phiware01:10:01

glad I could help, is the app for fun or profit?

jmb01:10:03

The app is for fun. I'm learning Reagent and building a web app to help me in my learning process.

au-phiware02:10:54

I have a problem with the :foreign-libs compiler option; I get Error: Can't resolve './util' when I use :foreign-libs [{:file "node_modules/bootstrap/js/src" :module-type :es6}]... can anyone explain how es6 modules that import relative file paths work with :foreign-libs?

au-phiware02:10:35

I have tried specifying the individual file also, but I get the same error:

:foreign-libs [{:file "node_modules/bootstrap/js/src/util.js"
                :provides ["bootstrap.util"]
                :module-type :es6}
               {:file "node_modules/bootstrap/js/src/alert.js"
                :provides ["bootstrap.alert"]
                :requires ["bootstrap.util"]
                :module-type :es6}]

au-phiware02:10:23

This is my ns call (ns cljsbuild-bootstrap4.core (:require [bootstrap.alert :as alert])) ...I'm still trying to make this work: https://github.com/au-phiware/cljsbuild-bootstrap4

au-phiware02:10:26

@anmonteiro, your earlier help was much appreciated and considering that there's an issue using npm-deps with modules that don't actually export anything, I thought I'd try bootstrap's es6 modules (that do export objects)... but either I'm missing something or I've found another issue?

kaosko03:10:44

any suggestions for a good library/pattern to control per-user long running operations (e.g. I have plenty of relatively per-user heavy file operations that cannot run in parallel, shouldn't be re-tried)?

tatut07:10:05

is there any workaround for CLJS-2352 with 1.9.908? using clojure 1.9.0-beta1

tatut07:10:41

downgrading clojure to -alpha19 for now

thheller09:10:53

I’m running a small twitter poll, please vote/share https://twitter.com/thheller/status/914427680690405378

grounded_sage10:10:46

Is it possible to gain access to the keyboard, mouse and screen remotely purely through a browser?

sundarj15:10:59

not possible 🙂

grounded_sage10:10:06

There is this but it seems to be tied to Electron. http://robotjs.io/docs/examples

mattbishop16:10:57

Anyone know how to tell cljs.repl.node where to find node?

mfikes16:10:42

@mattbishop Usually if a binary named node it is on your path it works. But if you have a special path or binary name, I’d try :node-command. See https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/repl/node.clj#L101

mfikes16:10:55

This should work with ClojureScript 1.7.10 or later.

mattbishop16:10:24

Yeah it's on my path but trying to get Cursive/piggieback to see it there isn't happening for me.

(cemerick.piggieback/cljs-repl (cljs.repl.node/repl-env))
java.io.IOException: Cannot run program "node"

mattbishop16:10:38

I'll try :node-command thanks!

mfikes16:10:23

@mattbishop Just be aware that the options are passed in the style of named parameters, so something like this should do it

(cemerick.piggieback/cljs-repl (cljs.repl.node/repl-env) :node-command "/usr/local/bin/node")

mattbishop16:10:39

Tried, failed: (cemerick.piggieback/cljs-repl (cljs.repl.node/repl-env :node-command "/usr/local/bin/node")) Same error can't find node.

mfikes16:10:50

Right… the options are on the other fn

mattbishop16:10:57

FWIW this works fine in CLI from lein repl

mfikes16:10:13

The options are not to the env, but to the cljs-repl fn

mattbishop16:10:18

let me try that

mattbishop16:10:11

(cemerick.piggieback/cljs-repl (cljs.repl.node/repl-env) :node-command "/usr/local/bin/node")
ClojureScript Node.js REPL server listening on 57640
To quit, type: :cljs/quit
=> nil

anmonteiro17:10:29

^ what is this sorcery? 🙂

dnolen17:10:23

@anmonteiro I’m curious how Lumo is related here - is that because you can just run Node.js projects on Glitch?

anmonteiro17:10:44

@dnolen seems like because Lumo is on NPM you can add it as a dependency

anmonteiro17:10:51

and then run the Lumo binary through Node

anmonteiro17:10:04

I’m a little bit mindblown to be honest

anmonteiro17:10:17

so they’re using the Lumo build API to compile that ClojureScript

naomarik18:10:28

what would you guys recommend to use as a build pipeline for this for code reload etc?

naomarik18:10:46

this question coming from someone that hasn’t looked at node for like 3 years 😉 very interested in running cljs though in this fashion

dnolen19:10:35

@naomarik Figwheel does that and it’s very popular