-
Notifications
You must be signed in to change notification settings - Fork 24.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android 0.13.0] Websockets throws exception 'No transports available' with Firebase #3645
Comments
Can you debug what's going on e.g. where the source of the error is? |
Wait you don't even see line numbers? The source map is fetched asynchronously. Do the line numbers appear after a while. It's possible source maps are not supported yet on Windows. |
Would be good to know whether source maps work or not. If more people confirm we should add it here: |
I've been using WebSockets with socket.io for sometime now. I had to disable the |
Interesting! Can you try using non-minified version of Firebase and reading it source at the place where it happens / Googling why Firebase throws this error? |
I'm glad the source maps are working for you! |
@satya164 @ide
But if you swap them around, you get the problem described:
It seems like the WebSocket polyfill is being loaded as part of the react-native module, which unfortunately doesn't work. So the work-around for the issue is to ensure you require react-native first, but it's still a bug. WebSockets are natively available on most browsers, so it's better to ensure they're available before module loading starts. |
omg, how didn't I think about that? thanks |
@puf, yes this is a known issue. For the time being, always start your entry point off with requiring/importing react-native. Would appreciate a PR adding that to the troubleshooting docs. |
Oh OK this is a tough one :) It would be amazing if you could send a PR to Firebase to make that error message more explanatory. Any other ideas to make this better? |
The Firebase client tries to use WebSockets to connect to the server, but they are missing (because the polyfill is not loaded yet). It then tries to fall back to long-polling, which it also cannot do in the context of React Native. So it finally throws an error that it cannot find a suitable transport mechanism to connect to the server. I think we'll have a better chance at people finding this issue (and the workaround of putting the require() statements in the right order) now that it's properly labeled/titled. |
Linked here: https://productpains.com/post/react-native/firebase-not-working-on-android/ Thanks so much for reporting and debugging this and adding the docs @puf! I'll close this one as it looks like the issue is solved. |
The cause of the problem is clear, there is a workaround, and we documented it to make it more findable. But there is still an underlying problem in the loading order of dynamic modules vs polyfills for native functionality (such as WebSockets). @ide commented that this was a known issue, in which case this report should probably be linked to that known issue too. |
@puf you mentioned:
Why so? I am looking to using socket.io in |
Hmm... I don't remember why I commented with that. On Tue, Aug 16, 2016 at 8:51 AM Param Aggarwal notifications@github.com
|
I'm using Firebase sdk which uses websocket, when I create a ref to my firebase I get the message.
The text was updated successfully, but these errors were encountered: