riemann-nodejs-client icon indicating copy to clipboard operation
riemann-nodejs-client copied to clipboard

Don't use `__dirname` when loading proto/proto.proto

Open stevus opened this issue 5 years ago • 4 comments

https://github.com/riemann/riemann-nodejs-client/blob/master/riemann/serializer.js#L17

When bundling, this becomes the directory of the caller, leading to:

(node:17555) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/proto/proto.proto'

stevus avatar Nov 11 '20 18:11 stevus

Good find, can you send a PR?

perezd avatar Nov 11 '20 18:11 perezd

Sure thing

stevus avatar Nov 11 '20 18:11 stevus

@perezd Is using the older .proto format required, or can it be migrated to use the JSON descriptors:

https://www.npmjs.com/package/protobufjs#using-json-descriptors

This would make bundling it easier since the proto.json file can be loaded along with the riemann client js.

stevus avatar Jan 04 '21 18:01 stevus

it could support both, but I won't accept a PR that breaks existing usages. Adding support while maintaining the original API would be fine tho.

perezd avatar Jan 04 '21 20:01 perezd