问题描述
我使用Twilio前端的JavaScript client创建了一个聊天客户端。我正在拨打以下电话以获得频道by SID
let channel_promise = client.getChannelBySid(sid);
这可以正常工作几个月,但是现在突然出现以下错误:
twilio-chat.js:28610 Uncaught (in promise) Error: Not Found
at TwilsockUpstreamError.ExtendableBuiltin (twilio-chat.js:28610)
at TwilsockUpstreamError.Twilsockerror (twilio-chat.js:28640)
at new TwilsockUpstreamError (twilio-chat.js:28719)
at Upstream._callee$ (twilio-chat.js:30068)
at tryCatch (twilio-chat.js:14232)
at Generator.invoke [as _invoke] (twilio-chat.js:14466)
at Generator.prototype.<computed> [as next] (twilio-chat.js:14284)
at step (twilio-chat.js:8227)
at twilio-chat.js:8238
ExtendableBuiltin @ twilio-chat.js:28610
Twilsockerror @ twilio-chat.js:28640
TwilsockUpstreamError @ twilio-chat.js:28719
_callee$ @ twilio-chat.js:30068
tryCatch @ twilio-chat.js:14232
invoke @ twilio-chat.js:14466
prototype.<computed> @ twilio-chat.js:14284
step @ twilio-chat.js:8227
(anonymous) @ twilio-chat.js:8238
Promise.then (async)
success @ conversations.js:653
j @ jquery-1.11.0.min.js:2
fireWith @ jquery-1.11.0.min.js:2
x @ jquery-1.11.0.min.js:4
b @ jquery-1.11.0.min.js:4
XMLHttpRequest.send (async)
(anonymous) @ VM11:1
send @ jquery-1.11.0.min.js:4
ajax @ jquery-1.11.0.min.js:4
join_conversation @ conversations.js:617
dispatch @ jquery-1.11.0.min.js:3
r.handle @ jquery-1.11.0.min.js:3
我正在从其CDN中获取客户端库并指定版本,因此我非常有信心这不会因为客户端代码的更改而中断。
<script src="https://media.twiliocdn.com/sdk/js/chat/v3.3/twilio-chat.js"></script>
通过将其登录到控制台,然后使用twilio-cli查找现有通道,我确认了所使用的通道SID是正确的。 cli的输出与控制台输出匹配,因此我知道我使用的是正确的SID。
有人知道为什么此呼叫失败吗?如何获得没有错误的频道?
function join_conversation(){
// Get the SID
const sid = $(this).attr('data-sid');
// Log the SID for debugging purposes.
console.log(sid);
// Get the channel.
let channel_promise = client.getChannelBySid(sid);
channel_promise.then(async function(channel){
...
})
}
from twilio.rest import Client
...
self.client = Client(self.account_sid,self.auth_token)
...
def get_conversations(self):
return self.client.conversations.conversations.list()
from twilio.jwt.access_token import Accesstoken
from twilio.jwt.access_token.grants import ChatGrant
...
def generate_chat_token(self,identity,service_sid):
# Get a token.
token = Accesstoken(self.account_sid,self.api_key,self.api_secret,identity=identity)
# Add a chat grant to the token.
grant = ChatGrant(service_sid=service_sid)
token.add_grant(grant)
return token.to_jwt()
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)