This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-15
Channels
- # babashka (3)
- # beginners (28)
- # calva (8)
- # cider (16)
- # clj-on-windows (4)
- # clojure (69)
- # clojure-europe (29)
- # clojure-norway (42)
- # clojure-uk (4)
- # community-development (5)
- # conjure (3)
- # cursive (18)
- # datomic (68)
- # emacs (23)
- # events (1)
- # honeysql (7)
- # introduce-yourself (1)
- # jobs (1)
- # lsp (11)
- # music (1)
- # observability (3)
- # off-topic (35)
- # other-languages (33)
- # releases (1)
- # remote-jobs (2)
- # ring (18)
- # shadow-cljs (16)
- # timbre (5)
- # tools-deps (9)
I'm having an issue with goog.string.format
not being defined under an advanced build, but working just fine in a development build. Minimalist example:
(ns app.lib.time
(:require
[goog.string :as gstring]))
(defn time-str
([]
(time-str (date-obj)))
([^js/Date date-obj]
(gstring/format "%02d:%02d:%02d" (.getHours date-obj) (.getMinutes date-obj) (.getSeconds date-obj))))
The error is:
app-d806f99da65c17cb4afc3c17a5f19e4952880d09.js:11676 Uncaught TypeError: $goog$string$$.format is not a function
That's with :pretty-print
and :pseudo-names
enabled.
I'm also using deps.edn
for my dependencies:
:deps {org.clojure/clojure {:mvn/version "1.11.3"}
org.clojure/clojurescript {:mvn/version "1.11.132"}
thheller/shadow-cljs {:mvn/version "2.28.6"}
com.google.javascript/closure-compiler-unshaded {:mvn/version "v20240317"}
...
In the compiled output, it's being turned into:
$goog$string$$.format("%02d:%02d:%02d", ...)
Ah ha! I found the answer. It's a quirk. It's mentioned here: https://clojurescript.org/reference/google-closure-library#requiring-a-function
> Sometimes symbols are not auto-included when requiring their parent namespace. This happens when those symbols are in their own file and require specific inclusion
Hi guys! I have a couple of lambdas in cljs using shadow-cljs on my work, and now they're throwing some kind of error that I never saw, unfortunately, I'm pretty new to this project, so I had no idea what broke the lambdas...
It seems it's related to some sort of ws
package which is not supposed to be a direct dependency:
errorMessage
Error: Cannot find module 'ws'
Require stack:
- /var/task/build/handler.js
- /var/runtime/index.mjs
errorType
Runtime.ImportModuleError
stack.0
Runtime.ImportModuleError: Error: Cannot find module 'ws'
stack.1
Require stack:
stack.2
- /var/task/build/handler.js
stack.3
- /var/runtime/index.mjs
stack.4
at _loadUserApp (file:///var/runtime/index.mjs:1087:17)
stack.5
at Object.UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)
stack.6
at start (file:///var/runtime/index.mjs:1282:23)
stack.7
at file:///var/runtime/index.mjs:1288:1
If I ignore that fact and install the ws package directly, I get this:
Have you ever seen that?
@message
2024-05-09T18:03:51.931Z undefined ERROR shadow-cljs - remote-error Error: connect ECONNREFUSED 127.0.0.1:9630
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 9630
}
I saw this issue on a package that uses shadow-cljs and wonder if it is related :thinking_face:
https://github.com/penpot/penpot/discussions/498the shadow-cljs devtools use the ws package, so if you intend on using those you need to install it either directly or via the shadow-cljs npm dependency
the error otherwise just says that the created build output could not connect back to the shadow-cljs server (for REPL and hot-reload)
that could happen for many reasons. can't comment without more details about the setup
Hmmmm, lemme try this devtools
first. It shouldn't be enabled for the lambdas anyway. The setup seems straighforward: deps on shadow-cljs.edn
and all the handlers in the main file.
by setup I meant where is the output running, in which runtime. where is shadow-cljs running? as you can see it tries to connect to 127.0.0.1
. so if any containers or VMs or whatever are involved that may be the issue
Nothing like talking to the one who knows stuff hahahaha :devtools {:enabled false}
fixed the problem! Thanks ❤️