Skip to content

Fetch image from android phone returning Failed to construct 'Response': The status provided (0) is outside the range [200, 599]. #38625

Description

@Punit-Vajpeyi

Description

While trying to read image from android phone internal storage, I am getting Failed to construct 'Response': The status provided (0) is outside the range [200, 599].

fetch(imagePath)

sample url: file:///data/user/0/com.test_app/cache/rn_image_picker_lib_temp_5c90be23-f414-4a9f-978a-cae5239fdd25.jpg

React Native Version

0.72.3

Output of npx react-native info

System:
OS: macOS 13.4.1
CPU: (8) arm64 Apple M2
Memory: 126.95 MB / 8.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.3.0
path: /opt/homebrew/bin/node
Yarn:
version: 1.22.19
path: /opt/homebrew/bin/yarn
npm:
version: 9.6.7
path: /opt/homebrew/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.12.1
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 22.4
- iOS 16.4
- macOS 13.3
- tvOS 16.4
- watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.9971841
Xcode:
version: 14.3/14E222b
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.19
path: /opt/homebrew/opt/openjdk@11/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.3
wanted: 0.72.3
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

Steps to reproduce

    fetch('file:///data/user/0/com.test_app/cache/rn_image_picker_lib_temp_5c90be23-f414-4a9f-978a-cae5239fdd25.jpg ')
      .then(response => {
        console.log('Fetch response', response);
      })
      .catch(error => {
        console.log('fetch error', error);
      });

Snack, screenshot, or link to a repository

Screenshot_20230725_235947

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions