azzamsa
(Azzam S.A)
November 8, 2024, 6:53pm
1
Hi,
I am using zefhemel/silverbullet latest 64f68b5300ea
and the space-scripts
is not loaded.
I tried to put them everywhere, but it wont work. I also tried different web browsers.
silverbullet.registerFunction("addThree", (a) => {
return a + 3;
});
{{addThree(2)}}
I don’t disabled them.
space on master
🦄 rg SB_SPACE_SCRIPT
space on master
🙊
Thanks!
bent0n
November 8, 2024, 7:17pm
2
When you reload, is there anything in the logs? The logs you show is when the function is trying to be used, not when reloading SilverBullet.
It’s possible some other SpaceScript fails to load and prevent this one from loading properly, this one seems to work fine for me.
zef
(Zef Hemel)
November 8, 2024, 7:19pm
3
The server logs are going to be more helpful. Template rendering happens on the server (unless you use sync mode, which is another thing to try) so the browser you use shouldn’t make any difference.
azzamsa
(Azzam S.A)
November 8, 2024, 8:23pm
4
To reproduce,
I created a file in silverbullet/space/Scripts/foo.md
With this content:
Then I put this code in Self.md
{{addThree(2)}}
Now I restart the docker image and watch the log.
After visiting Self.md
I get:
silverbullet-silverbullet-1 | Booted server with hostname 0.0.0.0
silverbullet-silverbullet-1 | Listening on http://0.0.0.0:3000/
silverbullet-silverbullet-1 | SilverBullet is now running: http://localhost:3000
silverbullet-silverbullet-1 | Requested file index.md
silverbullet-silverbullet-1 | Requested file index.md
silverbullet-silverbullet-1 | Requested file Hubs/Self.md
silverbullet-silverbullet-1 | Requested file SETTINGS.md
silverbullet-silverbullet-1 | Booting up worker for template
silverbullet-silverbullet-1 | Requested file Library/Core/Widget/Table of Contents.md
silverbullet-silverbullet-1 | Requested file Library/Core/Widget/Linked Mentions.md
silverbullet-silverbullet-1 | Error rendering template Error: Unknown function: addThree
silverbullet-silverbullet-1 | at data:application/javascript;base64,dmFyIFVlPU9iamVjdC5k......dHtJbyBhcyBwbHVnfTsK:1:940
silverbullet-silverbullet-1 | at data:application/javascript;base64,dmFyIFVlPU9iamVjdC5k......dHtJbyBhcyBwbHVnfTsK:1:988
silverbullet-silverbullet-1 | at innerInvokeEventListeners (ext:deno_web/02_event.js:754:7)
silverbullet-silverbullet-1 | at invokeEventListeners (ext:deno_web/02_event.js:801:5)
silverbullet-silverbullet-1 | at dispatch (ext:deno_web/02_event.js:658:9)
silverbullet-silverbullet-1 | at dispatchEvent (ext:deno_web/02_event.js:1043:12)
silverbullet-silverbullet-1 | at pollForMessages (ext:runtime_main/js/99_main.js:311:7)
silverbullet-silverbullet-1 | at eventLoopTick (ext:core/01_core.js:174:7)
silverbullet-silverbullet-1 | An exception was thrown as a result of invoking function renderTemplate error: Unknown function: addThree
silverbullet-silverbullet-1 | Booting up worker for query
silverbullet-silverbullet-1 | Requested file Library/Core/Widget/Linked Tasks.md
silverbullet-silverbullet-1 | Requested file Hubs/Self.md
azzamsa
(Azzam S.A)
November 8, 2024, 11:47pm
5
Tried more code. This is the result
silverbullet-silverbullet-1 | Requested file Library/Core/Widget/Linked Tasks.md
silverbullet-silverbullet-1 | Error rendering template Error: Unknown function: helloYeller
silverbullet-silverbullet-1 | at data:application/javascript;base64,dmFyIFVlPU9iamVjdC5k......dHtJbyBhcyBwbHVnfTsK:1:940
silverbullet-silverbullet-1 | at data:application/javascript;base64,dmFyIFVlPU9iamVjdC5k......dHtJbyBhcyBwbHVnfTsK:1:988
silverbullet-silverbullet-1 | at innerInvokeEventListeners (ext:deno_web/02_event.js:754:7)
silverbullet-silverbullet-1 | at invokeEventListeners (ext:deno_web/02_event.js:801:5)
silverbullet-silverbullet-1 | at dispatch (ext:deno_web/02_event.js:658:9)
silverbullet-silverbullet-1 | at dispatchEvent (ext:deno_web/02_event.js:1043:12)
silverbullet-silverbullet-1 | at pollForMessages (ext:runtime_main/js/99_main.js:311:7)
silverbullet-silverbullet-1 | at eventLoopTick (ext:core/01_core.js:174:7)
silverbullet-silverbullet-1 | An exception was thrown as a result of invoking function renderTemplate error: Unknown function: helloYeller
silverbullet-silverbullet-1 | Requested file _plug/query.plug.js
silverbullet-silverbullet-1 | Writing file Dailies/2024-11-09.md
silverbullet-silverbullet-1 | Requested file SETTINGS.md
azzamsa
(Azzam S.A)
November 9, 2024, 6:13pm
6
I’m not sure why, but client mode has resolved many of my issues with SilverBullet.
Now it works in client mode. Initially, it didn’t – I had to switch to another page and then back again to get it to work.
This issue was also fixed using client mode: Some of my pages are not indexed - #2 by azzamsa