Girish Poojari
Girish Poojari

Reputation: 29

Error while running Agora video on production server, works locally

I am trying to create a video chat using Angular 6 and Agora Web v2.50 SDK. I followed the tutorial on this link, https://medium.com/@Anderson7301/building-a-video-chat-app-with-agora-and-angular-6-858d72b6fa0d I was able to successfully implement this on my local machine but when I try to run it on the server I am getting “main.c71419ff14e542f66f51.js:1 ERROR TypeError: o.default.debug is not a function”. Can you please help me with. The server is running on SSL.

Update - 11/20/2018

I figured out that I needed to use the Dynamic Key for making the video chat work on the server. So I used the Dynamickey Generation Java code and created the token and while trying to join the user I am getting "Agora-SDK [ERROR]: User join failed [ERR_NO_AUTHORIZED]". Here's the log from my angular application.

11:24:34:202 Agora-SDK [INFO]: Creating client , MODE : interop CODEC : vp8 AgoraRTCSDK.min.js:2

11:24:34:215 Agora-SDK [INFO]: Initializing AgoraRTC client, appId: 1d82f0b2b87d445d81dfb2caf4f5e5b9. AgoraRTCSDK.min.js:2

11:24:34:264 Agora-SDK [INFO]: Initializing AgoraRTC client, appId: 1d82f0b2b87d445d81dfb2caf4f5e5b9.

active.component.ts:649 AgoraRTC client initialized AgoraRTCSDK.min.js:2

11:24:34:272 Agora-SDK [DEBUG]: Connect to choose_server: https://ap-web-1.agora.io/api/v1 AgoraRTCSDK.min.js:2

11:24:34:282 Agora-SDK [DEBUG]: Connect to choose_server: https://ap-web-2.agoraio.cn/api/v1 AgoraRTCSDK.min.js:2

11:24:34:951 Agora-SDK [DEBUG]: Get gateway address: (3) ["webrtc-159-117-159-4.agora.io:5875", "webrtc-128-1-33-131.agora.io:5866", "webrtc-159-117-159-3.agora.io:5870"] AgoraRTCSDK.min.js:2

11:24:34:957 Agora-SDK [INFO]: Joining channel: 1000 AgoraRTCSDK.min.js:2 11:24:34:964 Agora-SDK [DEBUG]: register client Channel 1000 Uid 1587154302 AgoraRTCSDK.min.js:2

11:24:34:973 Agora-SDK [DEBUG]: start connect:webrtc-159-117-159-4.agora.io:5875 AgoraRTCSDK.min.js:2

11:24:35:131 Agora-SDK [DEBUG]: websockect opened: webrtc-159-117-159-4.agora.io:5875 AgoraRTCSDK.min.js:2

11:24:35:235 Agora-SDK [DEBUG]: Connected to gateway server AgoraRTCSDK.min.js:2

11:24:39:336 Agora-SDK [ERROR]: User join failed [ERR_NO_AUTHORIZED]

The Dynamic token generated is 005AQAoAEY5MDBDNERFRkMxNzdDMkJGRjc5QUY5NDY2QTVEMDYzRTY4QTJCMDEQAB2C8LK4fURdgd+yyvT15bmaofNbWm6O7wAAAAAAAA==

AppId for my Project is 1d82f0b2b87d445d81dfb2caf4f5e5b9

thanks for your help in advance

Upvotes: 2

Views: 4879

Answers (4)

Well, in my case i implemented the token server in php with laravel, taked the answer from H Virginia Singh

$uid = (int) mt_rand(1000000000,9999999999);

And perfect. That definitelly worked for me.

Upvotes: 0

H Virginia Singh
H Virginia Singh

Reputation: 1

Generate a 10 digit random user id and pass that to the index code and use the same user id to generate the token. You will definitely join the channel

Upvotes: 0

Hermes
Hermes

Reputation: 2898

The issue you are having looks related to the user auth. Does the project work if you disable the token?

When you make the request to the token server to generate the access token are you passing a UserId? Are you using the same UserId when trying to join the channel or are you using the auto generation?

The reason I ask is because in my own recent testing with Agora.io's Token server, I noticed that you can generate a token with or without a UserId.

If you specify the UserId in the token generation, you need to reuse that UserId. If you pass a UserId as part of the request but then try to join the channel with the token and pass null as the UserId in the join it will fail.

If you don't specify a UserId in the token generation (the token should still generate) then you can use pass null as the UserId when joining the channel and it should work.

Upvotes: 2

Markus
Markus

Reputation: 43

I have the same problem with TypeError: o.default.debug when running in an Angular production build. It looks like the Agora library does not play well with the JS minifier which is used by Angular CLI in production builds. The only workaround I've come up so far is to set

"optimization": false

in angular.json, but that for sure is a very bad workaround.

Upvotes: 2

Related Questions