Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

net::ERR_FILE_NOT_FOUND when trying to fetch uri of TakePictureResponse #2008

Closed
2 tasks done
atrauzzi opened this issue Dec 17, 2018 · 3 comments
Closed
2 tasks done

Comments

@atrauzzi
Copy link

atrauzzi commented Dec 17, 2018

Bug Report

To Do First

  • Did you try latest release?
  • Did you look for existing matching issues?

Related Modules
RNCamera

Platforms
Android

Description/Current Behaviour

When I run the following:

        const picture = await this.camera.takePictureAsync({
            exif: true,
            doNotSave: false,
        });

        const fileRetrieve = await fetch(picture.uri);

...the last line triggers the following exception (regardless of whether I have the debugger attached or not):

Unhandled promise rejection TypeError: Network request failed

When I have the debugger attached and I'm inspecting network, I also see:

GET file:///data/user/0/com.my.app/cache/Camera/6e499c20-6e3e-4233-becf-12a1d5e381aa.jpg net::ERR_FILE_NOT_FOUND

Expected Behaviour
I expect to have a successful fetch response where I can obtain a Blob reference to my file so that I can use binary apis rather than using memory intensive and less performant base64 strings.

Steps to Reproduce
The code above inside of even the most basic of camera setups is more than sufficient.

I'm not using Expo.

Additionals

I have the following permissions in my AndroidManifest.xml:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

cc.

@n1ru4l
Copy link
Collaborator

n1ru4l commented Dec 17, 2018

What exactly do you want to do with the image?

@atrauzzi
Copy link
Author

I'd like to get a Blob object. Initially it'll be for sending the file to a server, but we also have a few other operations in mind where it'll be nice to have the standard Blob representation (watermarking, encryption).

Biggest thing here is I want to avoid loading all the data into memory as a base64 encoded string.

@atrauzzi
Copy link
Author

atrauzzi commented Dec 17, 2018

Entering this in as a separate comment - feel free to pick up my last response if you had something in mind, or any advice 😁 - but it appears as though I've been able to get access to the file thanks to this comment.

Seems like there's a problem in react native with fetch...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants