wkh237 / react-native-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.61k stars 1.59k forks source link

TypeError: Cannot set property isDerived of #<Blob> which has only a getter #672

Open therealaldo opened 6 years ago

therealaldo commented 6 years ago

Problem

I'm unable to build a blob after fetching an image and passing the path to the build method. I've tried not wrapping and wrapping the path with RNFetchBlob.wrap() and the same error keeps popping up. I know the file causing the error is ./polyfill/Blob.js and there seems to already be a method named markAsDerived() setting the isDerived value.

Versions

{
  "react": "16.2.0",
  "react-native": "0.53.3",
  "react-native-fetch-blob": "0.10.8"
}

Code Snippet

I'm using async.waterfall in my redux action creator that's trying to build the blob. This was working at one point, but since updating React Native, this error started popping up.

async.waterfall([
  // ...
  (cb) => {
    RNFetchBlob.config({ fileCache: true, appendExt: 'png' })
      .fetch('GET', image)
      .then(res => cb(null, res.path()))
      .catch(err => cb(err));
  },
  (imagePath, cb) => {
    Blob.build(RNFetchBlob.wrap(imagePath), { type: 'image/png;' })
      .then(blob => cb(null, blob))
      .catch(err => cb(err));
  },
  // ...
],
(err, results) => { //... });

Stack Trace

TypeError: Cannot set property isDerived of #<Blob> which has only a getter
    at new Blob (blob:http://localhost:8081/94ab5af2-ed89-4ced-b6e4-d49198e0cf46:133468:23)
    at blob:http://localhost:8081/94ab5af2-ed89-4ced-b6e4-d49198e0cf46:133444:11
    at tryCallTwo (blob:http://localhost:8081/94ab5af2-ed89-4ced-b6e4-d49198e0cf46:13482:7)
    at doResolve (blob:http://localhost:8081/94ab5af2-ed89-4ced-b6e4-d49198e0cf46:13646:15)
    at new Promise (blob:http://localhost:8081/94ab5af2-ed89-4ced-b6e4-d49198e0cf46:13505:5)
    at Function.build (blob:http://localhost:8081/94ab5af2-ed89-4ced-b6e4-d49198e0cf46:133443:16)
    at blob:http://localhost:8081/94ab5af2-ed89-4ced-b6e4-d49198e0cf46:144092:14
    at nextTask (blob:http://localhost:8081/94ab5af2-ed89-4ced-b6e4-d49198e0cf46:131005:22)
    at next (blob:http://localhost:8081/94ab5af2-ed89-4ced-b6e4-d49198e0cf46:131013:17)
    at blob:http://localhost:8081/94ab5af2-ed89-4ced-b6e4-d49198e0cf46:129339:24
PeterShortino20 commented 6 years ago

I seem to be running into the same problem with my blob

cameronazeez commented 6 years ago

+1 Having the exact same issue as well