Skip to content
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

fetch: Failed to connect to localhost/127.0.0.1:PORT #76

Open
lucaslenz opened this issue Oct 18, 2023 · 1 comment
Open

fetch: Failed to connect to localhost/127.0.0.1:PORT #76

lucaslenz opened this issue Oct 18, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@lucaslenz
Copy link

lucaslenz commented Oct 18, 2023

react-native: 0.72.4
react-native-file-access: 3.0.4
Platform: Android

Bug
I am using react-native-image-cache which utilizes this library. I am running in some errors on android when trying to load an image. I get the error from this call (FileSystem.fetch) with the following arguments:

source:  http://localhost:3000/some/path/over/here?someQueryParameter=true
path:  /data/user/0/<app-identifier>/cache/<...>/images/1d331f734be348d78fe4a71a2f8aeb4493a14338.jpg

The error message i get is

Maximum retries exceeded: Failed to connect to localhost/127.0.0.1:3000

This error is android only and also only occurs with the given parameters. When using another image and hence other parameters it's just working fine. I don't know if I'm missing anything but it seems like a bug. Working for the following parameters:

source: https://images.pexels.com/photos/36717/amazing-animal-beautiful-beautifull.jpg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1
path: /data/user/0/<appp-identifier>/cache/pingr/images/3486045310072102e400cc40bcab227cd0a7811a.jpg

The image does exist btw. and loads on iOS.

@lucaslenz lucaslenz added the bug Something isn't working label Oct 18, 2023
@lucaslenz
Copy link
Author

I just found out that it was my fault.

For everyone having the same issue you need to remap localhost to 10.0.2.2 when running in android emulator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant