question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DynamicLinks getDynamicLink sometimes not resolving long links correctly

See original GitHub issue

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository. If you have a general question, need help debugging, or fall into some other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow with the firebase tag.
  • For general Firebase discussion, use the firebase-talk google group.
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 7.0.0
  • Firebase Component: dynamic-links (Database, Firestore, Storage, Functions, etc)
  • Component version: BoM 28.3.1 (most current stable as of this typing)

[REQUIRED] Step 3: Describe the problem

👋 Hi there, I help maintain https://github.com/invertase/react-native-firebase/ and I’m seeing flaky behavior on this API call, I was hoping you could help me out.

The specific test case is here:

https://github.com/invertase/react-native-firebase/blob/3002caf4672e1df039a089b9109e444f8d8caf00/packages/dynamic-links/e2e/dynamicLinks.e2e.js#L69-L74

Which exercises this chunk of Java, with a long link:

https://github.com/invertase/react-native-firebase/blob/3002caf4672e1df039a089b9109e444f8d8caf00/packages/dynamic-links/android/src/main/java/io/invertase/firebase/dynamiclinks/ReactNativeFirebaseDynamicLinksModule.java#L205-L234

Steps to reproduce:

Feed a long link into the getDynamicLink method, and sometimes you get the target URI back as a return value, sometimes you get the long link back unchanged

Relevant Code:

// feed it this
private String TEST_LINK2 = `https://reactnativefirebase.page.link/?link=https://invertase.io/hire-us&apn=com.invertase.testingutm_source=github`;

// expect this
private String TEST_LINK2_TARGET = 'https://invertase.io/hire-us';


  public void resolveLink(String link) {
    try {
      FirebaseDynamicLinks.getInstance()
          .getDynamicLink(Uri.parse(link))
          .addOnCompleteListener(
              task -> {
                if (task.isSuccessful()) {
                  PendingDynamicLinkData linkData = task.getResult();
                  // Note: link == null if link invalid, isSuccessful is only false on processing
                  // error
                  if (linkData != null
                      && linkData.getLink() != null
                      && linkData.getLink().toString() != null) {
                    String linkUrl = linkData.getLink().toString();
                    int linkMinimumVersion = linkData.getMinimumAppVersion();
                    Bundle linkUtmParameters = linkData.getUtmParameters();
                    System.out.println("resolved to: " + linkUrl);
                  } else {
                    System.err.println("Dynamic link not found");
                  }
                } else {
                  System.err.println("resolve-link-error");
                }
              });
    } catch (Exception e) {
      // This would be very unexpected, but crashing is even less expected
     System.err.println("Unknown resolve failure");
    }
  }

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aguatnocommented, Aug 17, 2021

Hi @mikehardy We are looking into this issue. We have not been able to reproduce yet. We’ll likely need a repro or more specific details about a Firebase issue to help more. Moreover, try reproducing with our quickstart. This will help us isolate the issue and discard conflicts with other third party libraries being used. Please let me know if you have questions about this.

0reactions
mikehardycommented, Aug 31, 2021

That’s fair - I haven’t been able to come up with a reliable reproduction. This may only happen in far-fetched testing scenarios 🤷

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic Links - Can't get Url in android after install app from ...
When I use the long instead of short links, everything works perfectly fine. It's really just the short link, that is not working....
Read more >
Firebase Dynamic Link is not caught by getInitialLink if app is ...
1) The link properly opens the app if the app is not running but the getInitialLink does not get it. 2) If the...
Read more >
Working with Firebase Dynamic links | by Jyoti Dubey - Medium
A Dynamic Link is a deep link into your app that works whether or not your app is installed. It carries the following...
Read more >
Getting started with Dynamic Links on Android (Part 2 )
On today's episode of Firecasts, our host Sumit Chandel will show us how to receive and interpret the link in code for our...
Read more >
Debugging Dynamic Links - Firebase
Generate the flowchart by adding the d=1 parameter to any short or long Dynamic Link. For example, example.page.link/suffix?d=1 for a short ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found