georstat/react-native-image-cache

Error Could not find image file

Opened this issue · 4 comments

Hi!
Im getting this error
Could not find image file:///Users/macbookpro/Library/Developer/CoreSimulator/Devices/15DB62A5-3463-48C7-A25F-694A5F4F1CDF/data/Containers/Data/Application/C5A58443-6533-474A-85E1-8D914F803105/Library/images_cache/da2d862b5aa3909076da5802367a62add56635bb.png

And some images are no loading.

Screenshot 2023-12-13 at 4 02 52 PM Screenshot 2023-12-13 at 4 03 13 PM

Platform: iOS

    "@georstat/react-native-image-cache": "^3.1.0",
    "react": "18.2.0",
    "react-native": "0.72.6",

my code in the app.js

CacheManager.config = {
  baseDir:
    Platform.OS === 'ios'
      ? `${Dirs.LibraryDir}/images_cache/`
      : `${Dirs.CacheDir}/images_cache/`,
  blurRadius: 15,
  cacheLimit: 0,
  maxRetries: 3,
  retryDelay: 3000,
  sourceAnimationDuration: 500,
  thumbnailAnimationDuration: 500,
  getCustomCacheKey: (source: any) => {
    let newCacheKey = source;
    if (source.includes('?')) {
      newCacheKey = source.substring(0, source.lastIndexOf('?'));
    }
    return newCacheKey;
  },
};

this is an example of an uri in my server:

https://{SOME}.amazonaws.com/{SOME}/e0f2c062-2540-47c7-92b3-0a0e210fb681.jpeg?AWSAccessKeyId=AKIAT6CYCCTUOA625D6D&Expires=1702501015&Signature=OWBrS%2Fed%2BErzk2d0DWAk8b5%2BlGE%3D

@Paul12pp - hey did you find a solution for this?

@Paul12pp - hey did you find a solution for this?

Hi, I made my own image cache component using react-native-file-access, if you wanna I can send you the source code.

In my case it was due to misconfiguration on the google-storage side, where if for public images authorization header was present it was sending 401

And also the other issue is that once the error is received its response is then stored as a valid image cache file, and treated like that as well.
There's a need for a file unlinking after the error in retry function and better status checks, that includes all possible 4XX and 5XX errors