Open jensenhertz opened 2 years ago
I whipped up a quick browserified demo with the example code in README and the same problem occurs, the bootstrap server crashes with the type is required
error.
Is this with the test.js
within this repo?
I'm able to run npm run test
without getting the error you mentioned.
What operating system and node.js version are you using?
I am also getting the same error but, not in the tests, but in my personal project.
C:\WebstormProjects\sc-brain\node_modules\hyperswarm-proxy\messages.js:48
if (!defined(obj.type)) throw new Error("type is required")
^
Error: type is required
at encodingLength (C:\WebstormProjects\sc-brain\node_modules\hyperswarm-proxy\messages.js:48:35)
at Object.encode (C:\WebstormProjects\sc-brain\node_modules\hyperswarm-proxy\messages.js:72:40)
at Client.sendMessage (C:\WebstormProjects\sc-brain\node_modules\hyperswarm-proxy\index.js:105:26)
at Client.onUpdated (C:\WebstormProjects\sc-brain\node_modules\hyperswarm-proxy\index.js:46:10)
at Topic.handleUpdate (C:\WebstormProjects\sc-brain\node_modules\hyperswarm-proxy\server.js:161:14)
at Topic.emit (node:events:527:28)
at QueryStream.done (C:\WebstormProjects\sc-brain\node_modules\@hyperswarm\discovery\index.js:183:14)
at QueryStream.emit (node:events:527:28)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
I'm running Windows 10. With node v16.15.1 .
A few things to note:
Here is the point of error.
Any additional information needed, let me know, and I'll try to supply it.
I have a little more context as I dug in:
This is hyperswarm-proxy/index.js
EventType (from hyperswarm-proxy/messages.js) have these properties:
{
"READY": 1,
"JOIN": 2,
"LEAVE": 3,
"ON_STREAM_OPEN": 4,
"ON_STREAM_CLOSE": 5,
"ON_STREAM_DATA": 6,
"ON_STREAM_ERROR": 7,
"ON_PEER": 8,
"CONNECT": 9
}
The type that is looked for in EventType (of hyperswarm-proxy/messages.js) is "ON_UPDATED" which doesn't exist there.
Even hyperswarm-proxy/index.js defines a method to call the "ON_UPDATED", but hyperswarm-proxy/messages.js doesn't implement.
I'm running into curious problem with the library. I put up a test node on the server and replaced localhost in test.js. This causes the server to crash with the following error:
I also tried with the public bootstrap nodes mentioned in index.js and non of them work with the test. If I run the test with localhost server as it has by default, everything works perfectly 🤷
Am I doing something very wrong here or is this a bug?