0

I am new to Twilio and Angular!

I am creating a Twilio Client in Angular2 using Twilio Token which I am getting from the server. But I am getting below error.

I have already installed NuGet packages for Twilio-chat.

Code to create Twilio client.

const client = await Client.create(this.token);

Error

vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:2100 ERROR Error: Uncaught (in promise): Error: Can't connect to twilsock
Error: Can't connect to twilsock
    at Upstream.send (upstream.js?6143:144)
    at TwilsockClient.post (client.js?d83e:150)
    at executeWithRetry (network.js?2fab:122)
    at Retrier.retrier.on (network.js?2fab:78)
    at Retrier.EventEmitter.emit (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:79200)
    at Retrier.attempt (retrier.js?cc7c:28)
    at timeout.setTimeout (retrier.js?cc7c:67)
    at ZoneDelegate.invokeTask (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:84187)
    at Zone.runTask (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:83954)
    at ZoneTask.invokeTask (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:84262)
    at ZoneTask.invoke (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:84251)
    at timer (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:85791)
    at Upstream.send (upstream.js?6143:144)
    at TwilsockClient.post (client.js?d83e:150)
    at executeWithRetry (network.js?2fab:122)
    at Retrier.retrier.on (network.js?2fab:78)
    at Retrier.EventEmitter.emit (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:79200)
    at Retrier.attempt (retrier.js?cc7c:28)
    at timeout.setTimeout (retrier.js?cc7c:67)
    at ZoneDelegate.invokeTask (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:84187)
    at Zone.runTask (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:83954)
    at ZoneTask.invokeTask (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:84262)
    at ZoneTask.invoke (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:84251)
    at timer (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:85791)
    at resolvePromise (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:84575)
    at resolvePromise (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:84541)
    at vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:84624
    at ZoneDelegate.invokeTask (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:84187)
    at Object.onInvokeTask (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:5392)
    at ZoneDelegate.invokeTask (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:84186)
    at Zone.runTask (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:83954)
    at drainMicroTaskQueue (vendor.js?v=Y21ivCkyOiPlokFTbKpKeeclguwnaH8po-6x_Nx58pI:84361)
Vikrant
  • 4,920
  • 17
  • 48
  • 72
Manthan Makani
  • 119
  • 1
  • 6
  • You might want to catch the error and see if there's any other message. You can also check your access token that you're generating at http://jwt.io/ and see if anything looks wrong. Also, make sure you're not using test credentials to create the access token. – philnash Oct 11 '18 at 22:11
  • Thanks Philnash for the reply. I have resolved the issue with the help of Twilio support person. The issue was I was clearing Identity value from my server side code which was generating Token for me. So when creating the Client from typescript, Twilio was unable to detect the identity value and it was generating the error. Thanks again for the help. – Manthan Makani Oct 17 '18 at 06:33
  • Glad you got it sorted! – philnash Oct 17 '18 at 06:41

0 Answers0