Error: Not implemented. Use bindAsync() instead
See original GitHub issueProblem description
Code throws error: Error: Not implemented. Use bindAsync() instead at:
server.bind(
127.0.0.1:${PORT}, ServerCredentials.createInsecure())
throw new Error(‘Not implemented. Use bindAsync() instead’); ^
Error: Not implemented. Use bindAsync() instead at Server.bind (/home/sales/MEGAsync/projects/pc-command-grpc/server/node_modules/.pnpm/@grpc+grpc-js@1.6.7/node_modules/@grpc/grpc-js/build/src/server.js:200:15) at main (/home/sales/MEGAsync/projects/pc-command-grpc/server/dist/main.js:30:12) at Object.<anonymous> (/home/sales/MEGAsync/projects/pc-command-grpc/server/dist/main.js:34:1) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions…js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47
Reproduction steps
main.ts code:
`import { loadPackageDefinition, Server, ServerCredentials } from "@grpc/grpc-js"
import { loadSync, Options } from "@grpc/proto-loader"
import "dotenv/config"
import { join } from "path"
import { ProtoGrpcType as CommandGrpcType } from "./proto/command"
import { CommandServiceHandlers } from "./proto/command/CommandService"
if (!process.env.PORT) {
throw new Error("PORT not set!")
}
if (!process.env.PC_MAC_ADDRESS) {
throw new Error("PC_MAC_ADDRESS not set!")
}
const { PORT } = process.env
const commandProtoPath = join(__dirname, "..", "proto", "command.proto")
const loaderOptions: Options = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true
}
const commandProtoDefinition = loadSync(commandProtoPath, loaderOptions)
const commandPackageDefinition = loadPackageDefinition(
commandProtoDefinition
) as unknown as CommandGrpcType
const commandServiceHandlers: CommandServiceHandlers = {
TurnOn() {}
}
async function main() {
const server = new Server()
server.addService(
commandPackageDefinition.command.CommandService.service,
commandServiceHandlers
)
server.bind(`127.0.0.1:${PORT}`, ServerCredentials.createInsecure())
server.start()
console.log(`listening on port ${PORT}...`)
}
main()`
Environment
Linux Ubuntu 22.04 amd64 Node v16.15.0 Node installation method - nvm @grpc/grpc-js@1.6.7
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
That’s because it’s Not implemented, and you should Use bindAsync() instead.
https://github.com/grpc/grpc-node/tree/master/packages/grpc-js#migrating-from-grpc is basically documenting the differences from the legacy package.