0

I have 10 cloud functions for my application and they work fine from an android emulator and from postman. Simplest one of them is -

exports.verifySeller = functions.https.onCall((data)=>{
  return admin.firestore().collection("sellers").doc(data.sellerId).get().then(val=>{
    if( !val ){
      throw new Error('Not exist');
    }
    var resp = JSON.stringify({
      order:val.data()
    })
    return resp;
  }).catch(err=>{
    var resp = JSON.stringify({
      success:false,
      message:err.message
    })
    console.log('Error occured ', err )
    return resp;
  })
});

It gives "deadline exceeded" error when using from an actual device. I have gone through all the articles and stackoverflow queries but not found anything relevant to this.

Err  Error: DEADLINE_EXCEEDED
    at D:\MySpace\Node\native\odicustomer\node_modules\@react-native-firebase\functions\lib\index.js:72
    at onSuccess (D:\MySpace\Node\native\odicustomer\screens\Order\SellerSelect.js:92)
    at onPress (D:\MySpace\Node\native\odicustomer\screens\Order\SellerSelect.js:159)
    at Pressability._performTransitionSideEffects (D:\MySpace\Node\native\odicustomer\node_modules\react-native\Libraries\Pressability\Pressability.js:697)
    at Pressability._receiveSignal (D:\MySpace\Node\native\odicustomer\node_modules\react-native\Libraries\Pressability\Pressability.js:634)
    at onResponderRelease (D:\MySpace\Node\native\odicustomer\node_modules\react-native\Libraries\Pressability\Pressability.js:530)
    at Object.invokeGuardedCallbackImpl (D:\MySpace\Node\native\odicustomer\node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:265)
    at invokeGuardedCallback (D:\MySpace\Node\native\odicustomer\node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:476)
    at invokeGuardedCallbackAndCatchFirstError (D:\MySpace\Node\native\odicustomer\node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:500) 

According to other articles it might be network issue but I have cross checked with various network providers and still get the same result. Do I have to configure anything for an actual device for the function to work ? Any help will be much appreciated. Thanks.

sang
  • 109
  • 1
  • 1
  • 10
  • 1
    [Have you tried troubleshooting the issues from this post?](https://stackoverflow.com/questions/50195049/firebase-android-works-on-the-emulator-but-not-on-the-device) It could be caused by many things, but if it works on postman and the android emulator, a network configuration or problem with the device looks like the best place to start – Daniel Gomez Apr 27 '21 at 12:18
  • After trying a lot of things I decided to deploy the function in the cloud itself. Its working now. I just monitor the quota every time. Thanks. – sang May 01 '21 at 10:15
  • Could you post the solution as an answer? Thanks – Daniel Gomez May 03 '21 at 07:18
  • Sure I will post it. – sang May 04 '21 at 07:40

1 Answers1

2

After trying a lot of things I just decided to deploy the functions in the cloud itself. Its working fine now. Since I've already tested the functions in local device emulator I think I can just go ahead with the decision. I just monitor the quota everyday and its sufficient to test the functions in the real device.

sang
  • 109
  • 1
  • 1
  • 10