Home > database >  Firebase response is not valid JSON object
Firebase response is not valid JSON object

Time:08-18

I'm building a React Native App with firebase and over night I got error saying: response is not valid JSON object
Since I changed absolutely nothing and it worked just before I went to sleep I have seriously no idea what happend.

In my code it looks like this:

const getPosts = FireApp.functions().httpsCallable("getPosts");

let res = await getPosts();

I checked the function response before it is send, but it is just JSON

let response = JSON.stringify(items);
return response;

CodePudding user response:

Did you try set your region in your client?

Like this:

const getPosts = FireApp.functions("europe-west1").httpsCallable("getPosts");

let res = await getPosts();

Change europe-west1 by your region.

This has to be done if your function isn't hosted in the default US region.

CodePudding user response:

Done nothing and now it works just fine...

  • Related