#[AppwriteException: Already read]

30 messages · Page 1 of 1 (latest)

lusty iron
#

Hi, i created one web app and wanted to create react native app with the same database. When i typed all the ids and code, i got this error. I checked the code multiple times and it is alright, checked the web app, when i used some commands, collection got updated. I thought that its because there are 2 apps on the same project as a free tier, so i created new one but i get the same mistake. I use free tier. Can anybody help asap?

quartz pewter
#

Hello @lusty iron, can you share what you're trying to do and the code where the error happens?

Also, how are you accessing your db, are you using fetch, Appwrite's SDK, or another method?

lusty iron
#

This is how im getting data

#

useEffect(() => {

    const timeoutId = setTimeout(async () => {
      if (searchQuery.trim()) {
        await loadMovies();

        // Call updateSearchCount only if there are results
        if (movies?.length! > 0 && movies?.[0]) {
          await updateSearchCount(searchQuery, movies[0]);
        }
      } else {
        reset();
      } 
    }, 500);

    return () => clearTimeout(timeoutId);
  }, [searchQuery]);
stiff lichen
#

What's the full error and network request being made? Would be curious what the response is from that request as well.

lusty iron
#

This is the full error message, this updateSearchCount is suposed to update one filed, also when i tried this one for trending movies i get this error. Also, this console.log of response after listDocuments in first function is not even rendering

#

I mean i even looked at the code i am practicing and its the same, so i dont know if it has to do something with the account

#

this is the source code

lusty iron
stiff lichen
#

The error is literal, you can only read a response stream only once. Try adding logging to see where the duplicate reads are.

versed grove
#

if it's 0.7.1, can you try to force your app to use 0.7.0?

lusty iron
#

It worked like yesterday on another app, same principle

versed grove
static isle
#

I ran into this same issue today. Changing the react-native-appwrite package to 0.7.0 fixed the issue. I was on 0.7.1

thin scroll
#

I was getting the same error as the others above and forcing the app to use version 0.7.0 does fix the issue.

feral reef
#

Yes that is because they have removed "async" from function header in 7.0.1. I was about to snatch my head off yesterday, trying to debug because I was receiving the exact same error. I don't know how to call these functions when they're not set as async...

0.7.1
What's Changed

1, remove titles from method descriptions.
2. remove unnecessary asyncs and awaits.
3. fix AppwriteException response type to always be a string

gentle jasper
#

Thank you so much! Changing the react-native-appwrite package to 0.7.0 fixed the issue for me too. I don't understand why they removed the async/await. If somone has the explanation, it would be welcomed

gaunt wraith
#

This is indeed a bug welcomed in 0.7.1. Took me a few hours to debug, but going back to 0.7.0 fixed it for me.

Happened with using OAuth for me

dawn oasis
#

cc @earnest marsh

gentle jasper
#

@dawn oasis What do you mean by 'to set it'? I don't see any part of the documentation related to this. Or I missed something?

dawn oasis
gentle jasper
#

This is the way async/await works... only with 0.7.0 version of appwrite-react-native. I don't understand your point...

earnest marsh
# gentle jasper Thank you so much! Changing the react-native-appwrite package to 0.7.0 fixed the...

if you look at the sdk code, you will see most of the functions at the end use a call function at the end, which is coming from client.ts file. that function is using async and await

rest of the functions just return the promise returned by this function. hence async awaits there were basically unnecessary

you can still use the SDK same way as you used to, since they still return the same promise

#

some of our community members found having async awaits like these can have some amount of affect on performance. i remember a benchmark which improved times by around 0.1sec

#

not a lot, still made sense to make the change

#

hope that made sense! TLDR nothing should be changed on ur side 😄

earnest marsh