Skip to content

Missing chatLog.json file crashes nodeStorage #7

Open

Description

@andrewshell

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.

Activity

  1. scripting commented on Oct 23, 2020

    @scripting
    Owner

    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?

  2. andrewshell commented on Oct 23, 2020

    @andrewshell
    CollaboratorAuthor

    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.

  3. andrewshell commented on Oct 23, 2020

    @andrewshell
    CollaboratorAuthor

    My copy has the line commented out that caused the problem so it currently works.

  4. scripting commented on Oct 24, 2020

    @scripting
    Owner

    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.

  5. scripting commented on Oct 24, 2020

    @scripting
    Owner

    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.

  6. andrewshell commented on Oct 24, 2020

    @andrewshell
    CollaboratorAuthor

    Here are my steps. I followed the Quick Start instructions here:
    http://nodestorage.smallpict.com/2015/08/05/installingNodestorageOnUbuntu.html

    1. git clone https://github.com/scripting/nodeStorage.git
    2. cd nodeStorage
    3. npm install
    4. Registered as Twitter developer and got keys via https://apps.twitter.com/
    5. 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>"
    	}
    1. node storage.js
    2. Go to http://storage.shll.me:1229/
    3. Click "Sign on here" > "Sign on Twitter..."
    4. 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'
    }
    
  7. scripting commented on Oct 24, 2020

    @scripting
    Owner

    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

  8. andrewshell commented on Oct 24, 2020

    @andrewshell
    CollaboratorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions