This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-19
Channels
- # adventofcode (5)
- # announcements (1)
- # babashka (44)
- # beginners (83)
- # biff (10)
- # calva (1)
- # cherry (3)
- # cider (10)
- # clojure (78)
- # clojure-europe (12)
- # clojure-norway (1)
- # conjure (1)
- # cryogen (1)
- # datascript (4)
- # dev-tooling (2)
- # gratitude (2)
- # lsp (4)
- # malli (6)
- # off-topic (15)
- # polylith (9)
- # quil (19)
- # releases (1)
- # sci (6)
- # scittle (64)
- # sql (10)
- # squint (35)
Hello, I'm trying to add a plugin for Hoplon but I'm getting this error when running bb dev
on the demo folder after my changes:
[:main] Build failure:
------ ERROR -------------------------------------------------------------------
File: /home/y/.gitlibs/libs/io.github.babashka/sci.configs/08bab21643bc0c63a5b99c65193c9d24888270b7/src/sci/configs/funcool/promesa.cljs:183:13
--------------------------------------------------------------------------------
180 | 'do! (sci/copy-var do! pns)
181 | 'done? (sci/copy-var p/done? pns)
182 | 'error (sci/copy-var p/error pns)
183 | 'extract (sci/copy-var p/extract pns)
-------------------^------------------------------------------------------------
null
Unable to resolve var: extract in this context at line 183 sci/configs/funcool/promesa.cljs
--------------------------------------------------------------------------------
184 | 'finally (sci/copy-var p/finally pns)
185 | 'future (sci/copy-var future pns)
186 | 'thread-call (sci/copy-var p/thread-call pns)
187 | 'handle (sci/copy-var p/handle pns)
--------------------------------------------------------------------------------
error.cljs:7 ----- Scittle error ------------------------------
eval @ error.cljs:7
scittle$impl$error$ruler @ error.cljs:10
scittle$impl$error$error_handler @ error.cljs:65
scittle$core$eval_string @ core.cljs:71
scittle$core$eval_script_tags_STAR_ @ core.cljs:97
scittle$core$eval_script_tags @ core.cljs:103
eval @ core.cljs:116
error.cljs:7 Message: No context found in: sci.ctx-store/*ctx*. Please set it using sci.ctx-store/reset-ctx!
eval @ error.cljs:7
scittle$impl$error$error_handler @ error.cljs:70
scittle$core$eval_string @ core.cljs:71
scittle$core$eval_script_tags_STAR_ @ core.cljs:97
scittle$core$eval_script_tags @ core.cljs:103
eval @ core.cljs:116
error.cljs:7 Location: scittle-tag-1:6:11
eval @ error.cljs:7
scittle$impl$error$error_handler @ error.cljs:76
scittle$core$eval_string @ core.cljs:71
scittle$core$eval_script_tags_STAR_ @ core.cljs:97
scittle$core$eval_script_tags @ core.cljs:103
eval @ core.cljs:116
error.cljs:7 ----- Context ------------------------------------
eval @ error.cljs:7
scittle$impl$error$ruler @ error.cljs:10
scittle$impl$error$error_handler @ error.cljs:83
scittle$core$eval_string @ core.cljs:71
scittle$core$eval_script_tags_STAR_ @ core.cljs:97
scittle$core$eval_script_tags @ core.cljs:103
eval @ core.cljs:116
error.cljs:7
2 (require '[javelin.core :as j])
3
4 (j/defc title "From Hoplon")
5 (h/body
6 (h/h1 (h/text "~{title}")))
^--- No context found in: sci.ctx-store/*ctx*. Please set it using sci.ctx-store/reset-ctx!
eval @ error.cljs:7
scittle$impl$error$error_handler @ error.cljs:84
scittle$core$eval_string @ core.cljs:71
scittle$core$eval_script_tags_STAR_ @ core.cljs:97
scittle$core$eval_script_tags @ core.cljs:103
eval @ core.cljs:116
error.cljs:7 ----- Stack trace --------------------------------
eval @ error.cljs:7
scittle$impl$error$ruler @ error.cljs:10
scittle$impl$error$error_handler @ error.cljs:91
scittle$core$eval_string @ core.cljs:71
scittle$core$eval_script_tags_STAR_ @ core.cljs:97
scittle$core$eval_script_tags @ core.cljs:103
eval @ core.cljs:116
error.cljs:7 user - scittle-tag-1:6:11
clojure.core/let - <built-in>
user/with-let - scittle-tag-1:6:11
user - scittle-tag-1:6:11
user/text - scittle-tag-1:6:11
...
user - scittle-tag-1:6:11
user/body - scittle-tag-1:6:5
user - scittle-tag-1:6:5
user - scittle-tag-1:5:1
user - scittle-tag-1:5:1
eval @ error.cljs:7
scittle$impl$error$error_handler @ error.cljs:92
scittle$core$eval_string @ core.cljs:71
scittle$core$eval_script_tags_STAR_ @ core.cljs:97
scittle$core$eval_script_tags @ core.cljs:103
eval @ core.cljs:116
core.cljs:72 Uncaught cljs$core$ExceptionInfo {message: 'No context found in: sci.ctx-store/*ctx*. Please set it using sci.ctx-store/reset-ctx!', data: {…}, cause: Error: No context found in: sci.ctx-store/*ctx*. Please set it using sci.ctx-s
We need to update scittle itself to store the context like is done here: https://github.com/babashka/nbb/blob/e270785599bb9af605d684b02c3ad40b186e736f/src/nbb/core.cljs#L587
And everywhere in the code where the context is used, you must use sci.ctx-store/get-context
error.cljs:7 ----- Scittle error ------------------------------
eval @ error.cljs:7
scittle$impl$error$ruler @ error.cljs:10
scittle$impl$error$error_handler @ error.cljs:65
scittle$core$eval_string @ core.cljs:72
scittle$core$eval_script_tags_STAR_ @ core.cljs:98
scittle$core$eval_script_tags @ core.cljs:104
eval @ core.cljs:117
error.cljs:7 Message: Cannot read properties of null (reading 'substring')
eval @ error.cljs:7
scittle$impl$error$error_handler @ error.cljs:70
scittle$core$eval_string @ core.cljs:72
scittle$core$eval_script_tags_STAR_ @ core.cljs:98
scittle$core$eval_script_tags @ core.cljs:104
eval @ core.cljs:117
error.cljs:7 Location: scittle-tag-1:6:11
eval @ error.cljs:7
scittle$impl$error$error_handler @ error.cljs:76
scittle$core$eval_string @ core.cljs:72
scittle$core$eval_script_tags_STAR_ @ core.cljs:98
scittle$core$eval_script_tags @ core.cljs:104
eval @ core.cljs:117
error.cljs:7 ----- Context ------------------------------------
eval @ error.cljs:7
scittle$impl$error$ruler @ error.cljs:10
scittle$impl$error$error_handler @ error.cljs:83
scittle$core$eval_string @ core.cljs:72
scittle$core$eval_script_tags_STAR_ @ core.cljs:98
scittle$core$eval_script_tags @ core.cljs:104
eval @ core.cljs:117
error.cljs:7
2 (require '[javelin.core :as j])
3
4 (j/defc title "From Hoplon")
5 (h/body
6 (h/h1 (h/text "~{title}")))
^--- Cannot read properties of null (reading 'substring')
eval @ error.cljs:7
scittle$impl$error$error_handler @ error.cljs:84
scittle$core$eval_string @ core.cljs:72
scittle$core$eval_script_tags_STAR_ @ core.cljs:98
scittle$core$eval_script_tags @ core.cljs:104
eval @ core.cljs:117
error.cljs:7 ----- Stack trace --------------------------------
eval @ error.cljs:7
scittle$impl$error$ruler @ error.cljs:10
scittle$impl$error$error_handler @ error.cljs:91
scittle$core$eval_string @ core.cljs:72
scittle$core$eval_script_tags_STAR_ @ core.cljs:98
scittle$core$eval_script_tags @ core.cljs:104
eval @ core.cljs:117
error.cljs:7 user - scittle-tag-1:6:11
clojure.core/let - <built-in>
user/with-let - scittle-tag-1:6:11
user - scittle-tag-1:6:11
user/text - scittle-tag-1:6:11
...
user - scittle-tag-1:6:11
user/body - scittle-tag-1:6:5
user - scittle-tag-1:6:5
user - scittle-tag-1:5:1
user - scittle-tag-1:5:1
eval @ error.cljs:7
scittle$impl$error$error_handler @ error.cljs:92
scittle$core$eval_string @ core.cljs:72
scittle$core$eval_script_tags_STAR_ @ core.cljs:98
scittle$core$eval_script_tags @ core.cljs:104
eval @ core.cljs:117
core.cljs:73 Uncaught cljs$core$ExceptionInfo {message: "Cannot read properties of null (reading 'substring')", data: {…}, cause: TypeError: Cannot read properties of null (reading 'substring')
at Function.eval [as cljs$core$…, name: 'Error', description: undefined, …}
This is after fixing the code to get/set context.I think I know what's going wrong, the sources are saved in the context but sci/merge-opts doesn't preserve that key
I think this is something related to the h/text
macro. I tried some other hoplon code, and it seems to be working.
Ok, I think I'm understanding better what is going on. I will try to poke around a bit more with a local sci.config.
In the end I don't think this is related to context. I found that almost everything is working including h/text
depending on the input.
you absolutely need to do this:
https://github.com/babashka/sci.configs/blob/91c8eb918c80edaa0c1440070023a05b662538aa/playground/src/playground.cljs#L78
else h/text
will not work
or wait, probably I'm confusing something. you need sci.ctx-store for macroexpand: https://github.com/babashka/sci.configs/blob/91c8eb918c80edaa0c1440070023a05b662538aa/src/sci/configs/hoplon/hoplon.cljs#L58
I think scittle takes care of that? I only have some version changes and the index of the demo I'm using for that.
> I think scittle takes care of that? Yes, if you made those changes to scittle, else, not yet I think
yes, that is what I meant with "the sources" from the tags are stored in the context and they are probably getting lost due to a merge options
just read the source of how the tags are being inspected and where the result is stored
That is what I'm trying to explain. I don't think this is the problem. I think it is the macro that has an edge case for some inputs. The h/text
macro doesn't use macroexpand.
the stacktrace is leading to here:
eval @ error.cljs:7
scittle$impl$error$error_handler @ error.cljs:92
scittle$core$eval_string @ core.cljs:72
scittle$core$eval_script_tags_STAR_ @ core.cljs:98
scittle$core$eval_script_tags @ core.cljs:104
Just place a couple of printlns in there to inspect what is going wrong.Cannot reproduce. I bumped sci to the latest version and the error is gone. I thought that the code that was returning an error was still broken but it isn't. Everything is working now. 😅
wow thanks you guys for working through this, extremely excited
@U04VC31U8
This seems to be done. I'm testing everything in a html page using hoplon as a scittle plugin. I still need to publish the plugin but if you want you can build locally from https://github.com/babashka/scittle/pull/73
Go to the plugins/demo
folder and run npm install
them bb dev
http://localhost:1341 will serve the html from plugins/demo/resources/public/index.html
just noticed the demo readme is now wrong (the demo makes hoplon, not datascript now) i can send a PR when i play with it unless someone beats me to it
(also no objection from me for the demo default to be hoplon 😎 )
if you like, and i can augment the demo code to exercise both?
(or we can go back to datascript, just lmk and i can update the PR)
The changes I made: https://github.com/babashka/scittle/compare/main...mynomoto:scittle:main There are 2 commits, the first one attempting to add 2 plugins and the other one trying to add only a single plugin. Both are returning the same error.