You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm implementing a Custom CCP Panel. I'm trying to End a task by using the connection destroy API. However, I can't retrieve the connection from the task, I get the following error:
connect-streams.js:30338 Uncaught TypeError: Cannot read properties of undefined (reading 'create')
at createMediaInstance (connect-streams.js:30338:44)
at Object.get (connect-streams.js:30403:16)
at getMediaController (connect-streams.js:30213:115)
at Object.get (connect-streams.js:30231:16)
at Connection._initMediaController (connect-streams.js:1446:33)
at TaskConnection.Connection (connect-streams.js:1331:10)
at new TaskConnection (connect-streams.js:2399:16)
at connect-streams.js:1013:16
at Array.map (<anonymous>)
at Contact.getConnections (connect-streams.js:1009:40)
createMediaInstance @ connect-streams.js:30338
get @ connect-streams.js:30403
getMediaController @ connect-streams.js:30213
get @ connect-streams.js:30231
Connection._initMediaController @ connect-streams.js:1446
Connection @ connect-streams.js:1331
TaskConnection @ connect-streams.js:2399
(anonymous) @ connect-streams.js:1013
Contact.getConnections @ connect-streams.js:1009
endTask @ hook.ts:153
callCallback2 @ react-dom.development.js:4164
invokeGuardedCallbackDev @ react-dom.development.js:4213
invokeGuardedCallback @ react-dom.development.js:4277
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:4291
executeDispatch @ react-dom.development.js:9041
processDispatchQueueItemsInOrder @ react-dom.development.js:9073
processDispatchQueue @ react-dom.development.js:9086
dispatchEventsForPlugins @ react-dom.development.js:9097
(anonymous) @ react-dom.development.js:9288
batchedUpdates$1 @ react-dom.development.js:26140
batchedUpdates @ react-dom.development.js:3991
dispatchEventForPluginEventSystem @ react-dom.development.js:9287
dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @ react-dom.development.js:6465
dispatchEvent @ react-dom.development.js:6457
dispatchDiscreteEvent @ react-dom.development.js:6430
Show 24 more frames
Show less
react-dom.development.js:4312 Uncaught TypeError: Cannot read properties of undefined (reading 'create')
at createMediaInstance (connect-streams.js:30338:44)
at Object.get (connect-streams.js:30403:16)
at getMediaController (connect-streams.js:30213:115)
at Object.get (connect-streams.js:30231:16)
at Connection._initMediaController (connect-streams.js:1446:33)
at TaskConnection.Connection (connect-streams.js:1331:10)
at new TaskConnection (connect-streams.js:2399:16)
at connect-streams.js:1013:16
at Array.map (<anonymous>)
at Contact.getConnections (connect-streams.js:1009:40)
Here is my implementation in React:
const getCurrentTask = (): connect.Contact => {
if (!agent) {
throw new Error("Agent is not found")
}
const contacts = agent.getContacts(connect.ContactType.TASK)
if (!contacts.length) {
throw new Error("No incoming task found")
}
// TODO: Validate whether we need to find the task by contactId.
// I don't think we can have multiple tasks at the same time
const task = contacts[0]
return task
}
const endTask = (): Promise<string> => {
const task = getCurrentTask()
const connections = task.getConnections()
if (!connections || !connections.length) {
throw new Error("No connections found for the task")
}
const taskConnection = connections[0]
return new Promise((resolve, reject) => {
taskConnection.destroy({
success: () => resolve("Success ending task"),
failure: (err) => reject(err),
})
})
}
<Button name="endTask" size="md" type="button" onClick={endTask} />
The error is thrown when running the getConnections() method.
The text was updated successfully, but these errors were encountered:
Hi team,
I'm implementing a Custom CCP Panel. I'm trying to End a task by using the connection destroy API. However, I can't retrieve the connection from the task, I get the following error:
Here is my implementation in React:
The error is thrown when running the
getConnections()
method.The text was updated successfully, but these errors were encountered: