This message was deleted.
# helpdesk
s
This message was deleted.
d
@bulky-scientist-32583 What issues are you seeing? can you elaborate? CC: @eager-raincoat-52616
e
are there any error logs that appear when you try to connect?
b
Hi, @eager-raincoat-52616 In the screenshot, you can see the error that is caught in the catch block. I'm also copying the fragment of my code for you. The token and the URL that I pass as parameters are correct. According to this https://livekit.io/connection-test, it should work, and it also works in the sample app. Thank you
Copy code
const RoomPage = ({ route }) => {
  const [, setIsConnected] = useState(false)
  const [room] = useState(
    () => new Room({ adaptiveStream: { pixelDensity: 'screen' } }),
  )
  const { participants } = useRoom(room)
  const { url, token } = route.params
  const [isCameraFrontFacing, setCameraFrontFacing] = useState(true)


  console.log(room)
  useEffect(() => {
    let connect = async () => {
      try {
        await AudioSession.startAudioSession()
        await room.connect(url, token, {})
        setIsConnected(true)
      } catch (err) {
        console.log(err)
      }
    }

    connect()

    return () => {
      room.disconnect()
      AudioSession.stopAudioSession()
    }
  }, [url, token, room])
Error:
Copy code
TypeError: n.removeEventListener is not a function
    at Ko.handleDisconnect (livekit-client.umd.js:1)
    at Ko._callee115$ (livekit-client.umd.js:1)
    at tryCatch (regeneratorRuntime.js:44)
    at Generator.<anonymous> (regeneratorRuntime.js:125)
    at Generator.throw (regeneratorRuntime.js:69)
    at a (livekit-client.umd.js:1)
    at tryCallOne (core.js:37)
    at core.js:123
    at JSTimers.js:248
    at _callTimer (JSTimers.js:112)
d
which version of livekit-client are you using? it appears to be an old version that didn't properly check for RN during removeEventListener
b
I am using this:
Copy code
"@livekit/react-native": "^1.1.2",
"@livekit/react-native-webrtc": "^104.0.1",
d
can you add a line for
'livekit-client': '^1.12.0
?
b
yep, I will try
thanks
same error @dry-elephant-14928, but when I installed the package, it gave me the following warning.
Copy code
"@livekit/react-native": "^1.1.2",
"@livekit/react-native-webrtc": "^104.0.1",
"livekit-client": "^1.12.0",
I added this line "./package.json": "./package.json", The warning no longer appears, but the error that comes through the catch remains the same.
Copy code
"exports": {
    ".": {
      "types": "./dist/src/index.d.ts",
      "import": "./dist/livekit-client.esm.mjs",
      "require": "./dist/livekit-client.umd.js"
    },
    "./e2ee-worker": {
      "types": "./dist/src/e2ee/worker/e2ee.worker.d.ts",
      "import": "./dist/livekit-client.e2ee.worker.mjs",
      "require": "./dist/livekit-client.e2ee.worker.js"
    },
    "./package.json": "./package.json"
  },
d
@eager-raincoat-52616 any ideas here?
e
hmm, tried running it on 0.66.5 (there was a breaking bug on 0.66.4 that prevents android builds), didn’t run into this issue. did you remember to call
registerGlobals()
in your index.js file?
the only other thing I can think of is you have
document
defined by something in your app, and that’s making our library think it’s being run on web (and calling web-only methods)
b
Hello, thank you very much for your help. @eager-raincoat-52616 @dry-elephant-14928 Perhaps this information will be useful to future colleagues, the observable-hooks library hinders the proper functioning of LiveKit.
🙏 1
e
cc: @polite-kilobyte-67570
thanks for identifying the library, we’ll see if we can fix this up
@bulky-scientist-32583 hmm, I wasn’t able to reproduce it with the observable-hooks library. is it possible to upload a sample project that repros this issue?
b
maybe is this library "@rn-matrix/core" is causing the error. I use observable-hooks and rn-matrix/core tooto, I updated the library obsable-hooks to the last version in my app and in the rn-matrix/core. and the app continue failed. But when I delete those libreria, livekit start works @eager-raincoat-52616