AUTH_ERR_INVALID_APPID (The appId ********** does not exists in eu region )

I received the following error:
 Login failed with exception: {"error": {"code": "AUTH_ERR_INVALID_APPID", "message": "The appId ********** does not exists in eu region."}}

I am in the us region and that is in my env.js file. There doesn't seem to be enough information for me to determine if the issue is on my end or the cometchat SDK. I was upgrading from an older tutorial that wasn't functioning for the calling as seen in the "Audio Room Functionality Inquiry" post earlier discussed. Would love any insight in how to resolve. 

Dependencies

 "@cometchat/calls-sdk-react-native": "^4.0.4",
    "@cometchat/chat-sdk-react-native": "^4.0.5",
    "@cometchat/chat-uikit-react-native": "^4.1.2",
import React, {useState, useContext, useEffect} from 'react';

import {

  ActivityIndicator,

  StyleSheet,

  Text,

  TextInput,

  TouchableOpacity,

  View,

} from 'react-native';

import {CometChat} from '@cometchat/chat-sdk-react-native';

import AsyncStorage from '@react-native-async-storage/async-storage';

import validator from 'validator';

import {cometChatConfig} from '../../env';

import Context from '../../context';

import {getFirebaseData, signIn} from '../../services/firebase';

import {showMessage} from '../../services/ui';
const login = async () => {

    if (isUserCredentialsValid(email, password)) {

      setIsLoading(true);

      const userCredential = await signIn(email, password);

      if (!userCredential) return;

      const userId = userCredential.user.uid;

      console.log("The UserId for the person logging in: ",userId);

      await loginCometChat(userId);

    } else {

      setIsLoading(false);

      showMessage('Error', 'Your username or password is not correct');

    }

  };

  const isUserCredentialsValid = (email, password) => {
    return validator.isEmail(email) && password;
  };
 
const loginCometChat = async (id) => {

    if (!id) return;

    console.log("proceeding to use the updated SDK approach");

    CometChat.getLoggedinUser().then(

        user => {

            if (!user) {

                CometChat.login(id, `${cometChatConfig.cometChatAuthKey}`).then(

                    user => {

                        console.log("Login Successful:", { user });

                        handleSuccessfulLogin(user, id);

                    },

                    error => {

                        console.log("Login failed with exception:", { error });

                        setIsLoading(false);

                        showMessage('Error', 'CometChat login failed');

                    }

                );

            } else {

                // User is already logged in to CometChat

                handleSuccessfulLogin(user, id);

            }

        },

        error => {

            console.log("Error getting logged in user: ", error);

            setIsLoading(false);

            showMessage('Error', 'Error in CometChat getLoggedinUser');

        }

    );

  };

  const handleSuccessfulLogin = async (cometChatUser, userId) => {

      const authenticatedUser = await getUser(userId);

      if (authenticatedUser) {

          setIsLoading(false);

          setUser(authenticatedUser);

          saveAuthedInfo(authenticatedUser);

          navigation.navigate('Home');

      } else {

          setIsLoading(false);

          showMessage('Info', 'Cannot load the authenticated information, please try again');

      }

  };
 

 

0

Comments

1 comment
Date Votes

Please sign in to leave a comment.

  • Update:
    It sees that I initialized CometChatCalls, but not the basic CometChat. This seemed to rectify the initial error. I now have initializations for both.

     //Basic CometChat Sign in

        const appSetting = new CometChat.AppSettingsBuilder()

                            .subscribePresenceForAllUsers()

                            .setRegion(region)

                            .autoEstablishSocketConnection(true)

                            .build();

        CometChat.init(appID, appSetting).then(

          () => {

            console.log("Initialization completed successfully");

          }, error => {

            console.log("Initialization failed with error:", error);

          }

        );

       

        //CometCall (audio & video) sign in

        const callAppSettings = new CometChatCalls.CallAppSettingsBuilder()

          .setAppId(appID)

          .setRegion(region)

          .build();

        CometChatCalls.init(callAppSettings).then(

          () => {

            console.log('CometChatCalls was initialized successfully');

          },

          (error) => {

            console.log('CometChatCalls initialization failed with error:', error);

          },

        );

      };
    0

Didn't find what you were looking for?

New post