nhost / hasura-auth

Authentication for Hasura.
https://nhost.io
MIT License
372 stars 110 forks source link

Doesn't work with react-native? #526

Closed etodanik closed 3 weeks ago

etodanik commented 3 weeks ago

I get this: WARN Unexpected response: can't parse the response of the server at https://xxxxxxxxxxxxxx.auth.eu-central-1.nhost.run/v1/token ERROR Unhandled promise rejection [RangeError: Date value out of bounds]

I'm using auth version 0.31.0 in the config

onehassan commented 3 weeks ago

Can you paste the sdk versions you're using and the response from the /token endpoint

etodanik commented 3 weeks ago

"@nhost/react": "^3.5.2" "expo": "^51.0.13", "react-native": "0.74.2",

hermes is enabled.

I'll check the response now.

etodanik commented 3 weeks ago

Response is proving annoyingly tricky to capture. Devtools doesn't show it because hermes itself fails to parse it, and Expo is notoriously hard to work with VPN/Proxy.

EDIT: Could it be that the response it empty? Here's what I'm getting as a raw response (Note lack of body):

HTTP/1.1 200 OK
Date: Wed, 12 Jun 2024 20:52:56 GMT
Content-Type: application/json
Content-Length: 0
Connection: close
X-B3-Parentspanid: 
X-B3-Spanid: 
X-B3-Traceid: 0c61934b-9241-488b-83d3-4b7075d734db
etodanik commented 3 weeks ago

I'm finding this in logs:

{"time":"2024-06-12T20:56:44.028629467Z","level":"ERROR","msg":"call completed with errors","trace":{"trace_id":"f8b5b63a-8277-48c2-9889-969b8de689ad","span_id":"","parent_span_id":""},"request":{"client_ip":"176.233.31.164","method":"POST","url":"/v1/token"},"response":{"status_code":200,"latency_time":3859135,"errors":["json: error calling MarshalJSON for type types.Email: email: failed to pass regex validation"]}}

My project is a phone app that logins via phone only. I decidedly don't need email. Is that gonna be a problem now? As far as I understand there's a regression.

etodanik commented 3 weeks ago

Further investigation is: https://github.com/nhost/hasura-auth/pull/525

This seems to be related to my issue. It's a huge breaking problem for us.

onehassan commented 3 weeks ago

Ok will investigate further and let you know as soon as possible 👍

dbarrosop commented 3 weeks ago

why is the email empty in your case?

etodanik commented 3 weeks ago

why is the email empty in your case?

We are a ride sharing mobile app, the authentication happens by phone only and we do not intend to ever collect emails from our users.

We built our proof of concept on an earlier version of nhost that didn't enforce this - once we updated, things blew up.

dbarrosop commented 3 weeks ago

ok, thanks for the added info. Don't worry as we will fix this issue one way or another

etodanik commented 3 weeks ago

ok, thanks for the added info. Don't worry as we will fix this issue one way or another

Thanks for the super fast reaction! When does this land in a release? How do I get those changes in my Nhost instance?

dbarrosop commented 3 weeks ago

You can upgrade to 0.32.0.