nodecg / nodecg

Create broadcast graphics using Node.js and a browser
https://nodecg.dev
MIT License
1.07k stars 147 forks source link

Uploading or modifying assets crashes NodeCG server #455

Open hedgehog1029 opened 5 years ago

hedgehog1029 commented 5 years ago

When trying to upload or modify assets (either via the web panel or live-renaming the local file), the NodeCG server crashes due to an unhandled exception:

UNCAUGHT EXCEPTION! NodeCG will now exit.
TypeError: replicantsByNamespace[uploadedFile.namespace][uploadedFile.category].value.push is not a function
    at sha1File ([nodecg-root]/lib/assets/index.js:118:79)
    at ReadStream.<anonymous> ([nodecg-root]/node_modules/sha1-file/index.js:21:14)
    at ReadStream.emit (events.js:187:15)
    at ReadStream.EventEmitter.emit (domain.js:441:20)
    at endReadableNT (_stream_readable.js:1098:12)
    at process.internalTickCallback (internal/process/next_tick.js:72:19)
hedgehog1029 commented 5 years ago

just for the record: no components of the filepath contain any special characters, it's all just lowercase ascii

hedgehog1029 commented 5 years ago

I only have one bundle installed right now - it's based off the yeoman generator so I don't think I've done anything too weird?

Error occurs here in nodecg - seems like maybe bundles initializing replicants badly can cause full crashes?

Hoishin commented 5 years ago

Would it be possible to provide a bundle repo that can reproduce this issue? Cannot be sure if it's bundle related or core's problem.

hedgehog1029 commented 5 years ago

apologies for going dark on this - got pushed to the back of my mind while working on other things! I have a Sentry error report from this error.

The only place where I access the replicant is in a dashboard:

var jingles = nodecg.Replicant("assets:jingles", { defaultValue: [] });

jingles.on("change", (val) => app.jingles = val);
Kipples commented 5 years ago

I ran into this issue myself, I worked around it by deep cloning the replicant value.