Problem description
Using grpc_tools_node_protoc --js_out=import_style=commonjs,binary:. --grpc_out=minimum_node_version=8:. hello.proto produces generated code with new Buffer() instead of Buffer.from
It seems that the options are not passed to the compiler, trying an invalid option doesn't throw an error as expected from here: grpc/grpc@1de3f4a#diff-016162c2cbf07456eef32601d02d20b3R53
Reproduction steps
hello.proto
// Copyright 2016 Google, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
syntax = "proto3";
package hello;
// The hello service definition.
service Hello {
// Sends a greeting.
rpc Say (Request) returns (Response);
}
// The request message containing the user's name.
message Request {
string name = 1;
}
// The response message containing the greeting.
message Response {
string message = 1;
}
-> npm install -g grpc-tools
/usr/local/bin/grpc_tools_node_protoc -> /usr/local/lib/node_modules/grpc-tools/bin/protoc.js
/usr/local/bin/grpc_tools_node_protoc_plugin -> /usr/local/lib/node_modules/grpc-tools/bin/protoc_plugin.js
> grpc-tools@1.6.6 install /usr/local/lib/node_modules/grpc-tools
> node-pre-gyp install
[grpc-tools] Success: "/usr/local/lib/node_modules/grpc-tools/bin/grpc_tools.node" is installed via remote
+ grpc-tools@1.6.6
updated 1 package in 6.666s
grpc_tools_node_protoc --js_out=import_style=commonjs,binary:. --grpc_out=minimum_node_version=8:. hello.proto
The output file contains
function serialize_hello_Response(arg) {
if (!(arg instanceof hello_pb.Response)) {
throw new Error('Expected argument of type hello.Response');
}
return new Buffer(arg.serializeBinary());
}
which throws DeprecationWarning
Environment
- MacOS HighSierra 10.13.5
- Node v10.5.0
- brew
- package grpc-tools@1.6.6
- grpc_tools_node_protoc --version = libprotoc 3.4.0
Additional info
I've noticed that the NPM package has been last updated 9 months ago while the commit bringing support to minimum_node_version is from 1st of May, I suppose the issue comes from an outdated plugin?
Problem description
Using
grpc_tools_node_protoc --js_out=import_style=commonjs,binary:. --grpc_out=minimum_node_version=8:. hello.protoproduces generated code withnew Buffer()instead ofBuffer.fromIt seems that the options are not passed to the compiler, trying an invalid option doesn't throw an error as expected from here: grpc/grpc@1de3f4a#diff-016162c2cbf07456eef32601d02d20b3R53
Reproduction steps
hello.proto
The output file contains
which throws
DeprecationWarningEnvironment
Additional info
I've noticed that the NPM package has been last updated 9 months ago while the commit bringing support to minimum_node_version is from 1st of May, I suppose the issue comes from an outdated plugin?