not-an-aardvark / snoowrap

A JavaScript wrapper for the reddit API
MIT License
1.01k stars 125 forks source link

FetchAll() throwing : TypeError: Cannot assign to read-only property '_bitField' #382

Open NabeelUppel opened 1 year ago

NabeelUppel commented 1 year ago

I'm trying to get all subreddits that a user is subscribed to and I keep getting an error.

async function getAllSubscriptions() {
  try {
    const r = createSnoowrapRequester();
    r.config({ debug: true })
    let s = await r.getSubscriptions({ limit: 1 })
    //this works
    console.log(s.length);
   //this doesn't work
    let all = await s.fetchAll({ append: true });
    console.log(all.length);
  } catch (error) {
    console.log(error);
  }
}
TypeError: Cannot assign to read-only property '_bitField'

I tried FetchMore() and it works up to a certain amount. 100 works but 110 failed with the same error.

async function getAllSubscriptions() {
  try {
    const r = createSnoowrapRequester();
    r.config({ debug: true })
    let s = await r.getSubscriptions({ limit: 1 })
     //this works
    console.log(s.length);
    let all = await s.fetchMore({ amount: 100, append: true });
     //this doesn't works
    console.log(all.length);
  } catch (error) {
    console.log(error);
  }
}

I am using Expo Managed React Native.