Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't find proto file #5

Open
robomike opened this issue Oct 29, 2019 · 5 comments
Open

can't find proto file #5

robomike opened this issue Oct 29, 2019 · 5 comments

Comments

@robomike
Copy link

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
Copy link
Owner

w4tsn commented Jun 7, 2020

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
Copy link

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
Copy link

MrWhite80 commented Jul 7, 2020

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 added a commit that referenced this issue Jul 10, 2020
Using fs.watchFile seems to work on more cases than simply using watch.

Partially fixes issue discussed in #5
w4tsn added a commit that referenced this issue Jul 10, 2020
After watchFile won't work in the unit tests and is inferior to watch
according to the docs watch is used again.

This is related to #5
@w4tsn
Copy link
Owner

w4tsn commented Jul 10, 2020

@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
Copy link

Hi there,
I just found this awesome node 🥳
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants