Branch SDK Error

I am getting this Error: [Unhandled promise rejection: Error: BranchUniversalObject for ident A6987200-1271-49C2-A26C-E10B45B5A72B not found.]
while following the Example Documentation here: https://docs.expo.io/versions/latest/sdk/branch.html

My implementation looks like this:

createBranchUniversalObject = async () => {
    const { randomId } = this.props.onboarding
    this._branchUniversalObject = await Branch.createBranchUniversalObject(
      `${randomid}`,
      {
        title: `Leaderboard Share`,
        // contentImageUrl: ``,
        contentDescription: `User invite through Leaderboard`,
        // This metadata can be used to easily navigate back to this screen
        // when implementing deep linking with `Branch.subscribe`.
        metadata: {
          screen: 'MainLeaderboard',
          params: JSON.stringify({ volleyId }),
        },
      }
    )
    console.log(`createBranchUniversalObject branch obect: ${JSON.stringify(this._branchUniversalObject, null, 2)}`)
  }
  onShareLinkPress = async () => {
    console.log(`onShareLinkPress branch obect: ${JSON.stringify(this._branchUniversalObject, null, 2)}`)
    const shareOptions = {
      messageHeader: `Message Header`,
      messageBody: `Message Body`,
    }
    let linkProperties = { feature: 'share', channel: 'RNApp' }
    await this._branchUniversalObject.showShareSheet(shareOptions, linkProperties);
  }

The error is related to ident being associated with a different value in each method. I have tried to set everything inside state and call it but I’m still getting two separate ident results from each time this._branchUniversalObject is referred to.

I don’t see anything in the code you shared. :thinking:
How are you importing Branch? Could you be calling createBranchUniversalObject more than once?

import { Contacts, Permissions, MailComposer, DangerZone } from 'expo';
let { Branch } = DangerZone
componentDidMount() {
    // Branch.subscribe((bundle) => {
    //   if (bundle && bundle.params && !bundle.error) {
    //     // `bundle.params` contains all the info about the link.
    //     console.log(`BRANCH BUNDLE: ${bundle}`)
    //   }
    // })
    this.createBranchUniversalObject()
  }
<Button
    iconLeft
    key={i}
    style={styles.buttonStyle}
    // onPress={() => this.shareContent(item.title)}
    onPress={this.onShareLinkPress}
>

Those are the times that things are referenced

Here is the result:

createBranchUniversalObject branch obect: {
  "ident": "E4CF6754-1EC9-4734-B0B4-F3DCBF573ABA"
}

onShareLinkPress branch obect: {
  "ident": "D28E9676-71FF-47D4-A31F-C8B4C12319BD"
}

Hi, were you able to fix it?

No I tried to test it in a few different ways but nothing seemed to work. Any ideas?

Did you try to test it as a standalone app or using the expo client?

Using the Expo client.

you’ve got to test it as a standlaone app

1 Like

What do you mean by that?

Hmmm I’m facing the same error. By testing it as a standalone app, do you mean to go through the steps specified here https://docs.expo.io/versions/latest/guides/building-standalone-apps.html without submitting it to the app stores?

https://docs.expo.io/versions/latest/guides/building-standalone-apps.html

yes, that is what i mean

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.