solid-contrib / solid-node-client

a nodejs client for Solid
MIT License
20 stars 8 forks source link

Crashes with a null cookie #11

Open CxRes opened 3 years ago

CxRes commented 3 years ago

When I try to use solid-node-client in a nwjs environment, inside SolidNodeClient.prototype._getAuthFetcher, the cookie is set to null and then the program crashes since getAuthFetcher() expects a cookie to have length property. This might be a bug in solid-auth-fetcher and/or this call should exist in try catch block (in case authentication fails, though I am not sure why it would fail!).

Strangely, it works fine when I run the same code in Node LTS! I am not sure what trips the code up, I would appreciate any suggestions where to look...

CxRes commented 3 years ago

This actually seems identical to #10. (Should have read more carefully)

CxRes commented 3 years ago

Some more info... I get the following response from the fetch inside getNodeSolidServerCookie...

Response {type: "opaqueredirect", url: "https://inrupt.net/login/password", redirected: false, status: 0, ok: false, …}
body: null
bodyUsed: false
headers: Headers {}
ok: false
redirected: false
status: 0
statusText: ""
type: "opaqueredirect"
url: "https://inrupt.net/login/password"
__proto__: Response
jeff-zucker commented 3 years ago

I've added some error-trapping for the login process - https://github.com/solid/solid-auth-fetcher/pull/16 but since I've not seen anything like what you got above, I don't even know how to test for it. Is this coming from a specialized environment or straight from the command line?

CxRes commented 3 years ago

Yes, as mentioned above this is happening in an nwjs environment. However, I cannot identify anything environment specific that would prevent fetch from doing its thing. But #10 seems to occur in node.

I have special characters in the password which like #10 might be tripping me up. But strangely it worked fine for me in a node environment ( :head-scratching: )