Hi all,

I'm very new to Javascript and everything frontend (started playing around 
with it all on Monday so any and every kind of input here would be 
appreciated). I'm currently trying to set up a login page for a project I'm 
working on which just verifies that a user exists in a DB, checks the 
passwords, and generates and returns an auth token if everything checks 
out. I've written all the logic for this in a Go service that exposes 
itself on port 50000 (I've also tested this service and know that 
everything here is working). As per the documentation, I've set up an Envoy 
proxy that routes JS requests on port 8080 to the Go server at 50000 and, 
as far as I can tell, this is working too. Using Bloom RPC to test things, 
I've verified that the Envoy Proxy returns the errors I want when incorrect 
details are provided and returns the auth token when the correct ones are 
given. 

The relevant code snippet, from my index.js 
(https://github.com/NicholasBunn/mastersCaseStudy/blob/main/services/webFrontend/index.js),
 
is:
```
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;

console.log("Username is: ", username, " and password is: ", password);
var loginService = new LoginServiceClient("http://localhost:8080";);

var request = new LoginRequest();

request.setUsername(username);
request.setPassword(password);

loginService.login(request, {}, function (err, res) {
console.log("error:", err, " response:", res);
});
```

I suspect that the issue I'm having lies somewhere between Envoy and my JS 
frontend. When I make a login request with no username or an incorrect 
username, the expected error is written to the console in my browser (it's 
behaving as intended). However, as soon as I make a login request with an 
existing username (regardless of whether the password is correct or not), 
nothing is printed to the console. It's as if the response just skips all 
the code in the callback function.

If I check the log files for my backend services during this behaviour, the 
requests are going through and being processed perfectly with the responses 
being sent back through exactly as expected. I'm not too sure how to debug 
the proxy, and with that being the last place I can trace expected 
behaviour I suspect the problem is either in my Envoy setup or in the way 
I'm handling responses in JS. My Envoy setup can be found at 
https://github.com/NicholasBunn/mastersCaseStudy/blob/main/services/envoyProxy/envoy.yaml
 
- for the most part, it's the same as the Envoy setup given in the 
documentation.

Am I doing something blatantly wrong here?

Nic

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/1112cbb8-7d4f-445b-bc08-28a7b912adffn%40googlegroups.com.

Reply via email to