"Error: 14 UNAVAILABLE: Stream refused by server"
See original GitHub issueProblem description
syntax = "proto3";
package messager;
service Messager {
rpc getInfo(Request) returns (Reply){}
}
message Reply {
string raw = 1;
}
message Request {
string raw = 1;
}
// server.js
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');
const path = require('path')
let packageDefinition = protoLoader.loadSync(
path.join(__dirname, 'messager.proto'),
{
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true
});
let messager = grpc.loadPackageDefinition(packageDefinition).messager;
let server = new grpc.Server();
server.addService(messager.Messager.service, {
getInfo: (call, callback) => {
callback(null, { raw: 'This is server' });
}
});
server.bindAsync('0.0.0.0:3000', grpc.ServerCredentials.createInsecure(), (err, port) => {
if (err) {
console.log(err);
} else {
console.log('GRPC server binding on port: ' + port);
}
});
// client.js
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');
const path = require('path')
let packageDefinition = protoLoader.loadSync(
path.join(__dirname, 'messager.proto'),
{
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true
});
let messager = grpc.loadPackageDefinition(packageDefinition).messager;
let client = new messager.Messager('0.0.0.0:3000', grpc.credentials.createInsecure());
client.getInfo({}, (err, reply) => {
if (err) {
console.log(err);
} else {
console.log(reply);
}
})
Environment
- OS name: Ubuntu 19.10, version and architecture: [Linux Ubuntu 19.10 amd64]
- Node version: v12.16.1
- Package name and version: “@grpc/grpc-js”: “^1.0.3”, “@grpc/proto-loader”: “^0.5.4”,
Full Error
Error: 14 UNAVAILABLE: Stream refused by server
at Object.callErrorFromStatus (/Research/grpcjs/node_modules/@grpc/grpc-js/build/src/call.js:30:26)
at Object.onReceiveStatus (/Research/grpcjs/node_modules/@grpc/grpc-js/build/src/client.js:175:52)
at Object.onReceiveStatus (/Research/grpcjs/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:341:141)
at Object.onReceiveStatus (/Research/grpcjs/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:304:181)
at Http2CallStream.outputStatus (/Research/grpcjs/node_modules/@grpc/grpc-js/build/src/call-stream.js:115:74)
at Http2CallStream.maybeOutputStatus (/Research/grpcjs/node_modules/@grpc/grpc-js/build/src/call-stream.js:154:22)
at Http2CallStream.endCall (/Research/grpcjs/node_modules/@grpc/grpc-js/build/src/call-stream.js:140:18)
at ClientHttp2Stream.<anonymous> (/Research/grpcjs/node_modules/@grpc/grpc-js/build/src/call-stream.js:396:22)
at ClientHttp2Stream.emit (events.js:311:20)
at emitCloseNT (internal/streams/destroy.js:69:8) {
code: 14,
details: 'Stream refused by server',
metadata: Metadata { internalRepr: Map {}, options: {} }
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Error: 14 UNAVAILABLE: Stream refused by server #1969
The server may refuse to serve new requests if it is already handling too many other requests. This is normal behavior. Your client...
Read more >Stream refused by server. Create BigTable client per-request ...
Persistently receiving 14 UNAVAILABLE: Stream refused by server. Create BigTable client per-request? Ask Question. Asked 1 year, 7 months ago.
Read more >GRPC Core: Status codes and their use in gRPC
Code Number Description
OK 0 Not an error; returned on success.
FAILED_PRECONDITION 9
OUT_OF_RANGE 11
Read more >grpc/grpc - Gitter
A Kotlin grpc server running within aws ECS and fronted by an aws ALB set up to load balance ... Error: 14 UNAVAILABLE:...
Read more >Troubleshooting Response Errors | Cloud Endpoints with gRPC
If you receive error code 14 and the message upstream backend unavailable , this indicates that the Extensible Service Proxy (ESP) can't reach...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @dooleyb1 This problem happened because the “server” instance call server.start(); outside the callback when bindAsync.
So just starting the server in the callback solves the problem. It looks like this
Hi @lwmxiaobei, maybe your case is a different problem than mine. I also read some similar problems caused by setup “credentials”