nodeStorage
nodeStorage copied to clipboard
Missing chatLog.json file crashes nodeStorage
I installed a fresh copy of nodeStorage with local filesystem (not S3) I went to my homepage http://storage.shll.me:1229/ and did "Sign on Twitter" At this point the nodeStorage app would crash on the command line.
The issue was that my new user didn't have a chatLog.json file yet. All I did to fix this, was comment out line 556 in main.js so if the file didn't exist it just used the initial chat log struct from line 542. The first time I posted a message the chatLog.json file was created and it was no longer an issue.
First, I'm delighted you went down this path.
Next, I'm trying to reproduce.
What did you do a fresh install of?
nodeStorage is a module now. So there's nothing to fresh install.
I guess the question is what does "I went to my home page" mean?
What app should I be running?
I installed this repo. It says 1999 at the top. If you follow the link to storage.shll.me at the top you will see the homepage.
My copy has the line commented out that caused the problem so it currently works.
Andrew -- you're leaving out all the steps.
What did you actually do to get the error?
I'm sure you understand, I can't just go comment out lines of code without seeing the error on my machine and understanding what the problem is.
For example, I don't know what's in your config.json file. It's possible you made a mistake there. Where did you get it? There does not appear to be one in the repo.
Here are my steps. I followed the Quick Start instructions here: http://nodestorage.smallpict.com/2015/08/05/installingNodestorageOnUbuntu.html
-
git clone https://github.com/scripting/nodeStorage.git
-
cd nodeStorage
-
npm install
- Registered as Twitter developer and got keys via https://apps.twitter.com/
-
vim config.json
Using template from the Quick Start instructions
{
"enabled": true,
"myPort": 1229,
"myDomain": "storage.shll.me:1229",
"where": {
"flUseLocalFilesystem": true,
"publicPath": "mypublicfiles/",
"privatePath": "myprivatefiles/"
},
"basePublicUrl": "http://storage.shll.me:1229",
"twitterConsumerKey": "<mykey>",
"twitterConsumerSecret": "<mysecret>"
}
-
node storage.js
- Go to http://storage.shll.me:1229/
- Click "Sign on here" > "Sign on Twitter..."
- App crashes with the following:
openUserChatlog: the chatlog for andrewshell does not exist.
openUserChatlog: screenName == andrewshell, stats == {
"ctReads": 1,
"whenLastRead": "2020-10-24T16:02:57.203Z",
"ctWrites": 0,
"whenLastWrite": "1970-01-01T00:00:00.000Z",
"ctSecsLastRead": 0.002
}
events.js:292
throw er; // Unhandled 'error' event
^
Error [ERR_STREAM_WRITE_AFTER_END]: write after end
at writeAfterEnd (_http_outgoing.js:668:15)
at ServerResponse.end (_http_outgoing.js:788:7)
at dataResponse (/home/shellab/nodeStorage2/main.js:2180:17)
at /home/shellab/nodeStorage2/main.js:3156:13
at /home/shellab/nodeStorage2/main.js:584:5
at /home/shellab/nodeStorage2/lib/store.js:51:4
at ReadFileContext.callback (/home/shellab/nodeStorage2/node_modules/davefilesystem/filesystem.js:87:3)
at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:273:13)
Emitted 'error' event on ServerResponse instance at:
at writeAfterEndNT (_http_outgoing.js:727:7)
at processTicksAndRejections (internal/process/task_queues.js:81:21) {
code: 'ERR_STREAM_WRITE_AFTER_END'
}
Once I had a chance to step away from this, I figured out what was causing this behavior.
Look at this line.
https://github.com/scripting/nodeStorage/blob/master/main.js#L122
var urlHomePageContent = "http://1999.io/dev/index.html";
Not much thought went into that choice. And when I was working on 1999.io my thinking was this was going to be the main use of nodeStorage, so might as well have it default to the home page of that site.
What I will do is replace it with a plain vanilla home page, like all web servers come with, just saying this is the home page, congrats your server is working.
Dave
Awesome!
On Sat, Oct 24, 2020, at 3:55 PM, Dave Winer wrote:
Once I had a chance to step away from this, I figured out what was causing this behavior.
Look at this line.
https://github.com/scripting/nodeStorage/blob/master/main.js#L122
var urlHomePageContent = "http://1999.io/dev/index.html";
Not much thought went into that choice. And when I was working on 1999.io my thinking was this was going to be the main use of nodeStorage, so might as well have it default to the home page of that site.
What I will do is replace it with a plain vanilla home page, like all web servers come with, just saying this is the home page, congrats your server is working.
Dave
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/scripting/nodeStorage/issues/7#issuecomment-716053931, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDGCGI2TFGIVDZOO6TNU3SMM5NDANCNFSM4S43ME5A.