React-native-firebase: Create short dynamic link failure The operation couldn鈥檛 be completed. The service is currently unavailable.

Created on 2 Jan 2018  路  6Comments  路  Source: invertase/react-native-firebase

Issue

Some time i had crash in my app when service is unavailable :
This is my log :

2018-01-02 09:19:40.893843+0100 w99l[6388:149888] created short dynamic link: (null)
2018-01-02 09:19:40.896 [error][tid:com.facebook.react.JavaScript] The callback createShortDynamicLink() exists in module RNFirebaseLinks, but only one callback may be registered to a function in a native module.
2018-01-02 09:19:40.895782+0100 w99l[6388:150754] The callback createShortDynamicLink() exists in module RNFirebaseLinks, but only one callback may be registered to a function in a native module.
2018-01-02 09:19:40.899 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: The callback createShortDynamicLink() exists in module RNFirebaseLinks, but only one callback may be registered to a function in a native module.
2018-01-02 09:19:40.898841+0100 w99l[6388:150794] Unhandled JS Exception: The callback createShortDynamicLink() exists in module RNFirebaseLinks, but only one callback may be registered to a function in a native module.

Environment

  1. Application Target Platform:
    iOS

  2. Development Operating System:
    macOS Sierra

  3. Build Tools:

  4. React Native version:
    0.50.4

  5. RNFirebase Version:
    2.3.0

  6. Firebase Module:
    Dynamic Link

Links

Most helpful comment

Thanks for the fix @omer88.
@Kottidev we'll get a release out this week at some point with the fix in.

All 6 comments

Can we see your code usage please?

const socialMetaTagInfo = {
      socialTitle: params.title,
      socialImageLink: params.imageLink,
      socialDescription: params.description
};

return firebase.links().createShortDynamicLink({
      dynamicLinkDomain: Config.dynamicLinkDomain,
      link: `${link}?${qs.stringify(query)}`,
      androidInfo: {
        androidPackageName: Config.androidPackageName
      },
      iosInfo: {
        iosBundleId: Config.iosBundleId
      },
      socialMetaTagInfo
    });

The error makes it look like the promise callback is being called twice, which isn't supported by react native.

@omer88 Just taking a look at the code and I can see that most of the functions are surrounded by a try / catch block - what was the reasoning behind this?

My guess is that the inner handler is getting a rejection error, but the outer method is also throwing an exception. Both than call reject and it crashes.

It might be that we just need to change the outer try/catch to log rather than reject?

Hi @chrisbianca ,
I took a look at the code, I think I know what the problem is.
It's not the try/catch - although on second thought it's redundant and should be removed.
I'll create a PR to fix it.

Awesome, thanks @omer88 - shout if you need any help

Thanks for the fix @omer88.
@Kottidev we'll get a release out this week at some point with the fix in.

Was this page helpful?
0 / 5 - 0 ratings