I have a brand new tiddlywiki server edition (regenerated at will). I have to import two set of tiddlers. Each set is written is a valid json file. let call them “setup” and “user”
Each set can be imported as the firt one with success.
I can successfully import setup then standard but importing standard then setup will fail.
The error as it occurred is below. not very useful message and factually false (my files were validated with json lint online)
sudo docker run --rm -v /home/jnpr/big/workspace/accessibilite/dockerized/proteva-data:/usr/share/tiddlywiki/proteva-wiki proteva tiddlywiki proteva --load all-system-setup-tiddlers-proteva.json
undefined:1
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at $tw.Wiki.application/json (/usr/local/lib/node_modules/tiddlywiki/boot/boot.js:1614:16)
at $tw.Wiki.deserializeTiddlers (/usr/local/lib/node_modules/tiddlywiki/boot/boot.js:1509:23)
at Object.$tw.loadTiddlersFromFile (/usr/local/lib/node_modules/tiddlywiki/boot/boot.js:1776:23)
at Object.$tw.loadTiddlersFromPath (/usr/local/lib/node_modules/tiddlywiki/boot/boot.js:1828:22)
at /usr/local/lib/node_modules/tiddlywiki/boot/boot.js:1823:40
at Object.$tw.utils.each (/usr/local/lib/node_modules/tiddlywiki/boot/boot.js:126:12)
at Object.$tw.loadTiddlersFromPath (/usr/local/lib/node_modules/tiddlywiki/boot/boot.js:1821:15)
at Object.$tw.loadWikiTiddlers (/usr/local/lib/node_modules/tiddlywiki/boot/boot.js:2109:21)
at Object.$tw.loadTiddlersNode (/usr/local/lib/node_modules/tiddlywiki/boot/boot.js:2199:27)
import of all-system-setup-tiddlers-proteva.json done
I did a diff of the directory structure of the wiki in the two scenarios, setup-user for the success case and user-setup for the failed attempt. As expected, I will use that information to try to see what’s gone wrong and report. I think it could be useful.
Here’s the diff. (seulement dans = only in)
Seulement dans setup-user/proteva/tiddlers: $__config_NewJournal_Title.tid
Seulement dans setup-user/proteva/tiddlers: $__config_WikiParserRules_Inline_wikilink.tid
Seulement dans setup-user/proteva/tiddlers: $__DefaultTiddlers.tid
Seulement dans setup-user/proteva/tiddlers: $__SiteSubtitle.tid
Seulement dans setup-user/proteva/tiddlers: $__SiteTitle.tid
diff -r setup-user/proteva/tiddlers/$__StoryList.tid user-setup/proteva/tiddlers/$__StoryList.tid
1c1
< list: [[liste des projets]]
---
> list: GettingStarted
Seulement dans setup-user/proteva/tiddlers: $__themes_tiddlywiki_vanilla_settings_codefontfamily.tid
Seulement dans setup-user/proteva/tiddlers: $__themes_tiddlywiki_vanilla_settings_fontfamily.tid
I found out the reason of the crash: it was a json tiddler whose text field was empty. It should have be set to {} to be correct.
I also found out that while on the web wiki, having an empty text field for json tiddler is 100% OK. But stop the server (I’m on node.js) and restart it and hey! you’ve got a crash! This is the same thing with --load command.
Perhaps, testing json content agains empty and providing a default content of {} would be better. Have an error or warning message on the console too.
The interactive support of empty textfield for json tiddlers is the reason for my json file to get one for they were export of my single file wiki for my new node wiki.
Here’s a filter to find any such empty json tiddlers:
[field:type[application/json]field:text[]]
I didn’t remember about the field operator, which is the only way I know to get such a filter. In particular, I had devised [search:type[application/json]] :filter[get[text]match[]] and [search:type[application/json]] :filter[search:text:regexp[^$]]and also [search:type[application/json]] :filter[get[text]is[blank]] that all fail.
Apologies @jypre I may not be understanding you correctly. I tried pasting the example JSON tiddler into a file test.json, and then executed the following command without problems:
$ sudo docker run --rm -v proteva-data:/usr/share/tiddlywiki/proteva-wiki proteva tiddlywiki --load bug.json[sudo] Mot de passe de jnpr :
Error: No tiddlers found in file "bug.json"
I am seeing this issue with 5.1.23 and the prerelease when running with nodejs. In the browser I create a new tiddler with no content and save it as a application/json type. I then kill the nodejs tw processes and rerun the server command and see
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at $tw.Wiki.application/json (C:\Users\jeffr\Documents\dev\js\TiddlyWiki5\boot\boot.js:1614:16)
at $tw.Wiki.deserializeTiddlers (C:\Users\jeffr\Documents\dev\js\TiddlyWiki5\boot\boot.js:1509:23)
at Object.$tw.loadTiddlersFromFile (C:\Users\jeffr\Documents\dev\js\TiddlyWiki5\boot\boot.js:1776:23)
at Object.$tw.loadTiddlersFromPath (C:\Users\jeffr\Documents\dev\js\TiddlyWiki5\boot\boot.js:1828:22)
at C:\Users\jeffr\Documents\dev\js\TiddlyWiki5\boot\boot.js:1823:40
This is under window 10 in a git bash shell
note I get a .json.meta file alone with the empty .json tid
Thanks @buggyj I can confirm that I am seeing the same results. One ends up with a blank New Tiddler.json file and a New Tiddler.json.meta file containing the created, modified, title, tags, type field.
But I am still confused, because that seems to be a different bug than the one that @jypre is reporting. It works if I try to --load the directory containing New Tiddler.json.
In particular, can anyone else confirm that attempting to --load the following file bug.json gives them an error:
Existent documentation on tiddlywiki.com has not helped me building tw5. My problem is I am on Docker to get node.js and then I have a difficulty with the host or the network. If I do a docker run -p 8080:8080 image sh bin/serve.sh , the host is not reachable but I don’'t know how to specify the host. If I create a network and run docker attached to it, it doesn’t work either. I’m still a newcomer to docker, there is something I should have wrong but my docker inspect have not helped me (maybe I don’t know what I should look for in this case).
Here was my Dockerfile:
from node:16.9.0-alpine3.11
LABEL author="Jean-Pierre RIVIÈRE"
LABEL content="instance de nodejs pour construire des éditions de tiddlywiki"
env WORKDIR=/var/opt/tiddlywiki
EXPOSE 8080
WORKDIR $WORKDIR
VOLUME $WORKDIR
run apk update && apk add --no-cache tini
ENTRYPOINT ["/sbin/tini", "--"]
CMD sh
I build the “node” image with
sudo docker build . -t node
in the directory where is Dockerfile.
Here’s a a simple launching of the container:
sudo docker run -it --rm -v $PWD/TiddlyWiki5:/var/opt/tiddlywiki -p 8080:8080 node sh
and once in the container:
# sh bin/serve.sh
Boot log:
Startup task: load-modules
Startup task: info after: load-modules before: startup
Startup task: plugins after: load-modules
Startup task: startup after: load-modules
Startup task: story after: startup
Startup task: commands platforms: node after: story
Executing command: server 8080 $:/core/save/all text/plain text/html localhost
syncer-server-filesystem: Dispatching 'save' task: $:/StoryList
Serving on http://127.0.0.1:8080
(press ctrl-C to exit)
Variation with network:
sudo docker network create --driver bridge --subnet 192.168.0.0/16 twn
sudo docker run -it --rm -v $PWD/TiddlyWiki5:/var/opt/tiddlywiki --network twn node sh
@jeremyruston, have you tried with the dockerfile I pasted to have my very same setup? BTW, I’m on debian buster with kernel 4.19.0-17-amd64.
Where could I get a pre-release edition of 5.20 so that I could try with it if I still have this bug? Would it be helpful if I tried with the previous version of tw?