rchain-community / rchain-api

An API for rchain dapps to communicate with the blockchain
Other
22 stars 12 forks source link

Deprication warning for grpc.load #10

Closed JoshOrndorff closed 6 years ago

JoshOrndorff commented 6 years ago

https://github.com/JoshOrndorff/RChain-API/blob/master/rnodeAPI.js#L40 uses grpc.load which is deprecated and generates warnings.

DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead

The @grpc/proto-loader is demonstrated at https://grpc.io/docs/tutorials/basic/node.html#loading-service-descriptors-from-proto-files

Previously we ran into problems with this approach because we had to serialize data client-side. Now that we're using https://github.com/dcodeIO/protobuf.js making this switch seems feasible.

JoshOrndorff commented 6 years ago

This should have been a trivial fix which I've committed in 470eb0ef87f64860667a79c3582f3cb1e0190498

Now hitting an error that appears to have been experienced by others: https://groups.google.com/forum/#!topic/protobuf/HWx1U_-cJ4g

$ node rnodeAPI.js localhost 4041
/home/joshy/ProgrammingProjects/RChain-API/node_modules/protobufjs/src/root.js:243
        throw Error("unresolvable extensions: " + this.deferred.map(function(field) {
        ^

Error: unresolvable extensions: 'extend google.protobuf.FileOptions' in .scalapb, 'extend google.protobuf.MessageOptions' in .scalapb, 'extend google.protobuf.FieldOptions' in .scalapb, 'extend google.protobuf.EnumOptions' in .scalapb, 'extend google.protobuf.EnumValueOptions' in .scalapb
    at Root.resolveAll (/home/joshy/ProgrammingProjects/RChain-API/node_modules/protobufjs/src/root.js:243:15)
    at Object.loadSync (/home/joshy/ProgrammingProjects/RChain-API/node_modules/@grpc/proto-loader/build/src/index.js:153:16)
    at RNode (/home/joshy/ProgrammingProjects/RChain-API/rnodeAPI.js:40:41)
    at integrationTest (/home/joshy/ProgrammingProjects/RChain-API/rnodeAPI.js:340:14)
    at Object.<anonymous> (/home/joshy/ProgrammingProjects/RChain-API/rnodeAPI.js:397:3)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
JoshOrndorff commented 6 years ago

Oh! This is why I originally commented the scalapb stuff in the first place. Commenting out the import scalapb.proto line from each proto file gets us past this error.

JoshOrndorff commented 6 years ago

Now stuck on

 Error: 14 UNAVAILABLE: Connect Failed
    at Object.exports.createStatusError (/home/joshy/ProgrammingProjects/RChain-API/node_modules/grpc/src/common.js:87:15)
    at Object.onReceiveStatus (/home/joshy/ProgrammingProjects/RChain-API/node_modules/grpc/src/client_interceptors.js:1188:28)
    at InterceptingListener._callNext (/home/joshy/ProgrammingProjects/RChain-API/node_modules/grpc/src/client_interceptors.js:564:42)
    at InterceptingListener.onReceiveStatus (/home/joshy/ProgrammingProjects/RChain-API/node_modules/grpc/src/client_interceptors.js:614:8)
    at callback (/home/joshy/ProgrammingProjects/RChain-API/node_modules/grpc/src/client_interceptors.js:841:24)

@dckc I need your debugging help.

dckc commented 6 years ago

ugh.

dckc commented 6 years ago

typo: deprecate, not depricate

JoshOrndorff commented 6 years ago

Woah, how did github know to close the issue? Is it because of the commit message?

dckc commented 6 years ago

yes.