CommunicationIdentityClient createUser() unable to create the Token

Josue Avila Mendoza 0 Reputation points
2024-07-21T06:26:44.4933333+00:00

Hi i have this issu, i had to isolated the call to azure communication service from the original React Native module in order to do it in a "clean scenario", i have been stuck here since 1 month, :( , and haven't been able to solve it

im getting next error when a do the call

This is the error

"TypeError: Cannot read property 'id' of undefined\n at ?anon_0_ (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.nvchat&modulesOnly=false&runModule=true:140852:51)\n

                                                        at next (native)\n    at asyncGeneratorStep (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.nvchat&modulesOnly=false&runModule=true:31311:19)\n    

														at _next (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.nvchat&modulesOnly=false&runModule=true:31325:29)\n    

														at tryCallOne (address at InternalBytecode.js:1:1180)\n    

														at anonymous (address at InternalBytecode.js:1:1874)\n    

														at apply (native)\n    

														at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.nvchat&modulesOnly=false&runModule=true:38059:26)\n    

														at _callTimer (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.nvchat&modulesOnly=false&runModule=true:37938:17)\n    

														at _callReactNativeMicrotasksPass (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.nvchat&modulesOnly=false&runModule=true:37983:17)\n    

														at callReactNativeMicrotasks (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.nvchat&modulesOnly=false&runModule=true:38189:44)\n    

														at __callReactNativeMicrotasks (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.nvchat&modulesOnly=false&runModule=true:2154:48)\n    

														at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.nvchat&modulesOnly=false&runModule=true:1927:45)\n    

														at __guard (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.nvchat&modulesOnly=false&runModule=true:2126:15)\n    

														at flushedQueue (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.nvchat&modulesOnly=false&runModule=true:1926:21)\n    

														at callFunctionReturnFlushedQueue (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.nvchat&modulesOnly=false&runModule=true:1911:33)"

I should mention ; this was working great in the past since i updated the React Native environment , Gradlew and Node , it did not work any longer ,

react-native-cli: 2.0.1

react-native: 0.74.2

node : v20.14.0

Gradle 8.6

Hermes

 "@azure/communication-chat": "^1.1.1",

"@azure/communication-common": "^1.1.0",

"@azure/communication-identity": "^1.2.0",

"@azure/communication-signaling": "^1.0.0-beta.11",

"@azure/core-auth": "^1.4.0",

async function  CreateUser (e){

  const endpoint = "<MyConnectionString>";
  const identityClient = new CommunicationIdentityClient(endpoint);

  try{
    let identityResponse = await identityClient.createUser();
    console.log(`\nCreated an identity with ID: ${identityResponse.communicationUserId}`);
    
   }
   catch (ex)
   {
      console.log(ex)
   }

}
```Any advice or help It will be appreciate ; thanks in advance

Regards

Josue Avila

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
1,239 questions
Microsoft 365 and Office | Development | Office JavaScript API
Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Authenticator
Microsoft Security | Microsoft Identity Manager
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.