supabase: React Native .from().select() promise never resolves in release (Expo)
Bug report
Describe the bug
When testing the from().select() function in debug mode in an ejected Expo app the data is returned successfully, however, once you switch to the release variant, nothing is returned. The app does not crash meaning no major errors are being thrown.
To Reproduce
const { data, error } = await supabase
.from('table')
.select('*')
.eq('column', variableToMatch);
Expected behavior
The expected behaviour is that the call will return the requested data from the Supabase table or an error suggesting that something went wrong.
System information
- OS: macOS
- Version of supabase-js: v1.11.12
- Version of Node.js: v14.16.0
- Version of Async Storage: v1.15.4
- Version of Expo: v41.0.0
- Version of React Native: v0.63.4
Additional context
I have been getting these logs: Error getting session from URL.
, nw_socket_handle_socket_event [C5:1] Socket SO_ERROR [61: Connection refused]
, nw_connection_get_connected_socket [C5] Client called nw_connection_get_connected_socket on unconnected nw_connection
, TCP Conn 0x2806304d0 Failed : error 0:61 [61]
, SocketRocket: In debug mode. Allowing connection to any root cert
but I am uncertain whether the last four pertain to Supabase. Happens on both Android and iOS.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 33 (10 by maintainers)
@kiwicopple honestly have no idea, never really looked into how (or why)
react-native-url-polyfill
works.After many wasted hours @Hannes1 figured out that
react-native-url-polyfill
was the culprit. We were using the latest version but when we downgraded tov1.2.0
the promises were getting resolved. Thanks @soedirgo and @kiwicopple for the help. Love your product btw, plan on using it for my personal projects into the foreseeable future.It turns out upgrading react native fixed this issue. Sorry for the red herring.
My cofounder is of the opinion that the issue arises in _getAuthHeaders in supabase-js/src/SupabaseClient.ts line 82 here:
No network requests are ever sent to the Postgrest API so it isn’t getting rejected by the endpoint, it just never gets sent
@kiwicopple, I noticed that Gotrue Client uses
cross-fetch
as well and it seems to work in production which is odd. Thus I doubt thatcross-fetch
by itself is the culprit. What do you do differently when it comes to network requests between the two?