w4tsn / node-red-contrib-protobuf

NodeRED node for encoding and decoding of protobuf messages.
BSD 3-Clause "New" or "Revised" License
7 stars 10 forks source link

can't find proto file #5

Open robomike opened 4 years ago

robomike commented 4 years ago

Hi all,

I have tried many different relative paths to the .proto file. The problem is I keep getting this error: "Proto file could not be loaded. Error: ENOENT: no such file or directory, open '"../src/assets/protocol_buffers_files/generic_message.proto"'

I have also tried this "/src/assets/protocol_buffers_files/generic_message.proto"

The instance of my node-red deployment is on heroku. The relative path is correct. Why can't node-red-contrib-protobuf find the proto file?

w4tsn commented 4 years ago

I'm not quite sure right now what causes this. The path from the config node is just handed over to the protobufjs library, which then throws the error.

Can you provide a little more context?

MrWhite80 commented 4 years ago

I have the same issue. The configuration never seems to be satisfied and nodered will log the following

[error] [protobuf-file:cb338d5.45df67] Error when trying to watch the file on disk: Error: ENOENT: no such file or directory, watch

I'm running Nodered in windows in this case, and put the full path to the proto file. I also tried moving the proto file into the nodered installation folder, or the various probuff module folders, but same result.

MrWhite80 commented 4 years ago

note that I changed the protofile.js to use watchFile instead of watch, and the error goes away. A quick test of the encode, seems to work.

I also noticed for windows the regex used to validate the file path isn't correct. Causes the node to look like it's miss configured

validate:RED.validators.regex(/^(\/[^\/ ]*)+\/?$/)

Instead of this validation, I removed it, and in the encode and decode nodes I added this in the registration of the nodes to show to the user, the config is currently not valid

if(this.protofile.prototypes === undefined){ this.error("No protobuf supplied"); this.status({fill:"red",shape:"dot",text:"Proto Not found"}); } else this.status({fill:"green",shape:"dot", text:"Ready"});

NOTE the file watch doesn't seem to work though...

w4tsn commented 4 years ago

@MrWhite80

I think we have to different issues here: this issue is about certain access problems to files on heroku. I don't know about that one right now @robomike

The other one has to do with the file watch feature for which I'll open a separate issue (#12). Since it seems to cause problems for some people the option to use a file watch is now opt-out in the configuration node as a workaround until the issue is better understood and solved. As for your fix since the watchFile code is not working (I verified that) it's basically deactivating the file watch which is now configurable.

Then there is the issue with the insufficient / broken validator for paths which only respects unix paths. The validator is already removed in 1.0.5

domiko96 commented 2 years ago

Hi there, I just found this awesome node :partying_face: Unfortunately it doesn't work for me, I get this error in node-red: No .proto types loaded! Check that the file exists and that node-red has permission to access it.

I have the node configured like so: image

Inside the container the file-system looks like this: image (owner is node-red user). I also tried different locations in the container. (I'm running NodeRed v.1.2.9 on an odroid in docker.)

What kind of path is one supposed to fill in - an absolute path should work no? Any support/suggestion is greatly appreciated.