const AbcRequest = new DomainMessage();
nexusRequest.setMesssage("QueryTest");
grpc.unary(AbcService.Fields, {
request: AbcRequest,
host: "https://localhost:5001/",
onEnd: res =>{
const { status, statusMessage, headers, message, trailers } = res;
if (status === grpc.Code.OK && message) {
var result = message.toObject() as AbcResponse.AsObject;
this.response = result.jsonresponsedata;
}
}
});
"Error: Response closed without headers
at Object.onEnd (http://localhost:4200/main.js:1257:21)
at http://localhost:4200/vendor.js:62504:24946
at Array.<anonymous> (http://localhost:4200/vendor.js:62504:5685)
at e (http://localhost:4200/vendor.js:62504:1567)
at http://localhost:4200/vendor.js:62504:1681
at ZoneDelegate.invokeTask (http://localhost:4200/polyfills.js:412:35)
at Object.onInvokeTask (http://localhost:4200/vendor.js:44161:33)
at ZoneDelegate.invokeTask (http://localhost:4200/polyfills.js:411:40)
at Zone.runTask (http://localhost:4200/polyfills.js:180:51)
at invokeTask (http://localhost:4200/polyfills.js:493:38)"
const service = new AbcServiceClient('https://localhost:5001', null);
const request = new DomainMessage();
request.setMesssage('QueryTest');
service.fields(request, null, (err, response: AbcField) => {
console.log(response.toObject());
if (err) {
console.log(err);
}
});
Access to fetch at 'https://localhost:5001//AbcApi.AbcService/Fields' from origin 'http://localhost:4200' has been blocked by CORS policy:
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Is it possible to run angular accessing grpc with out using docker?
thanks.
--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/0949924e-ee23-44e3-acc2-c52dab1065e6%40googlegroups.com.
On your first code snippet, what is "grpc.unary"?On your second approach, are you using grpc-web? If so, you need to set up Envoy to handle the CORS request (and handle the grpc-web requests in general) like this.In general grpc-web browser clients cannot directly talk to a grpc backend server. You need Envoy and grpc-web to do the translation. See https://github.com/grpc/grpc-web/tree/master/net/grpc/gateway/examples/helloworld for an example.
To unsubscribe from this group and stop receiving emails from it, send an email to grp...@googlegroups.com.