Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ReferenceError: cljs_http is not defined #129

Open
xlisp opened this issue Feb 3, 2021 · 2 comments
Open

Uncaught ReferenceError: cljs_http is not defined #129

xlisp opened this issue Feb 3, 2021 · 2 comments

Comments

@xlisp
Copy link

xlisp commented Feb 3, 2021

I use the cljs-http in chrome extension, it's version "0.1.46" . but i get this error:

(go (let [response (<! (http/get "https://api.github.com/users"
                           {:with-credentials? false
                            :query-params {"since" 135}}))]
        (prn (:status response))
        (prn (map :login (:body response)))))

截屏2021-02-04 上午12 09 44

@ulrichschinz
Copy link

Hi there. Could you solve that problem, I get the same error in similar circumstances.

(ns myproject.rap.api
  (:require-macros [cljs.core.async.macros :refer [go]])
  (:require [cljs-http.client :as http]
            [cljs.core.async :refer [<!]]))

(defn get-document [lemmisee]
  (go (let [response (<! (http/get "https://api.github.com/users" 
                                   {:with-credentials? false
                                    :query-params {"since" 135}}))]
        (prn response))))

Opening the repl and calling (get-document 1) leaves me with following message:

myproject.rap.api=> (get-document 1)
#object[TypeError TypeError: Cannot read properties of undefined (reading 'get_document')]
         (<NO_SOURCE_FILE>)

Calling only the http/get request, says me, that cljs_http is not defined:

(<! (http/get "https://api.github.com/users"
                                 {:with-credentials? false
                                  :query-params {"since" 135}}))

#object[ReferenceError ReferenceError: cljs_http is not defined]
         (<NO_SOURCE_FILE>)

I already removed all from ./target/dev and also refreshed cache in ~/.m2/repository. But it leaves me with this error.

Any hints?

@ulrichschinz
Copy link

Hi there,

I solved the problem. I just didn't require the new created file, which in turn required the other stuff (like cljs-http).
After requiring it in another file, it just worked fine.
Given the example above I had to do a

(:require [myproject.rap.api :as api])

Then I could just use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants