# \[useConnection\] nickname-sync failure \[SendbirdError: Connection is required\]

**URL:** <https://community.sendbird.com/t/useconnection-nickname-sync-failure-sendbirderror-connection-is-required/8803>\
**Category:** React Native\
**Created:** [December 26, 2023, 11:03pm UTC](https://community.sendbird.com/t/useconnection-nickname-sync-failure-sendbirderror-connection-is-required/8803 "2023-12-26T23:03:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hanskamin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/hanskamin/32/4814_2.png) [@hanskamin](https://community.sendbird.com/u/hanskamin)\
**Post date:** [December 26, 2023, 11:03pm UTC](https://community.sendbird.com/t/useconnection-nickname-sync-failure-sendbirderror-connection-is-required/8803/1 "2023-12-26T23:03:20Z")

</div>

**[Problem/Question]**  
I’ve built a sign-in screen based on the one in the Sendbird sample app. I take a user’s phone number in a text input and check if it exists in my MongoDB. If the phone number doesn’t exist, I add the phone number to my MongoDB, generate a user ID, and then call the `connect` function from the `useConnection` hook like this: `await connect(userId, { nickname })`, where `nickname` is `'New User'`.

Up until today, this has worked just fine – calling `connect` updated the `currentUser` object, which I used to conditionally render the next screen. Now, after no changes to my code, I receive a `nickname-sync failure` error, with no other context or stack trace provided.

After logging the value of `currentUser` before and after calling `connect`, I noticed that `currentUser` is undefined before calling the function and null after calling the function. Thus, the rest of my app fails to conditionally render.

Having a very hard time determining what’s changed, and I’m on a time crunch, so any help that leads to fixing this error is sincerely appreciated. Thank you!

* * *

// If problem, please fill out the below. If question, please delete.  
**[UIKit Version]**  
3.1.2, building an Expo application

**[Reproduction Steps]**  
// Please provide reproduction steps and, if possible, code snippets.  
My `App.tsx`:

```auto
export default function App() {
  ...

  return (
    <SendbirdUIKitContainer
      appId={sendbirdAppId}
      chatOptions={{ localCacheStorage: AsyncStorage }}
      platformServices={{
        file: FileService,
        notification: NotificationService,
        clipboard: ClipboardService,
        media: MediaService,
      }}
    >
      <UrlContext.Provider value={{ url, setUrl }}>
        <Navigation />
      </UrlContext.Provider>
    </SendbirdUIKitContainer>
  );

```

My `Navigation.tsx`:

```auto
export function Navigation() {
  ...

  return (
    <OnboardingContext.Provider value={{ isOnboarded, setIsOnboarded }}>
      <NavigationContainer>
        {
          currentUser ? <SignedInStack.Navigator screenOptions={{ headerShown: false }}>
            <SignedInStack.Screen name="App" component={AppNavTree} initialParams={{ channelUrl: url }} />
          </SignedInStack.Navigator>
          : <SignedOutStack.Navigator screenOptions={{ headerShown: false }}>
            <SignedOutStack.Screen name="Login" component={SignInScreen} />
          </SignedOutStack.Navigator>
        }
      </NavigationContainer>
    </OnboardingContext.Provider>
  );
};

```

In my `SignInScreen.tsx` I have a submit button that triggers the logic to search for the given phone number in my MongoDB, generate a user ID, and call the `connect` function as described above.

**[Frequency]**  
Each time I run the app and try to sign in.

**[Current impact]**  
Unable to move forward with pushing to prod until this is resolved.
