Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] device.register() get stuck when the WebSocket fails to connect #231

Closed
8 tasks done
kamalbennani opened this issue Dec 28, 2023 · 2 comments
Closed
8 tasks done
Labels
bug Something isn't working jira added

Comments

@kamalbennani
Copy link
Contributor

kamalbennani commented Dec 28, 2023

  • I have verified that the issue occurs with the latest twilio.js release and is not marked as a known issue in the CHANGELOG.md.
  • I reviewed the Common Issues and open GitHub issues and verified that this report represents a potentially new issue.
  • I verified that the Quickstart application works in my environment.
  • I am not sharing any Personally Identifiable Information (PII)
    or sensitive account information (API keys, credentials, etc.) when reporting this issue.

Code to reproduce the issue:

While attempting to initialize a Twilio Device with an expired token results in the failure of executing subsequent code following the invocation of await device.register().
This occurs due to the Twilio WebSocket being closed caused by the token expiration, preventing the register() promise to be resolve/reject.

(async () => {
  try {
    const device = new Device('AnyExpiredToken');
    await device.register()
  } finally {
    console.log('log never reached');
  }
})()

Expected behavior:

The .register() function should throw an error indicating that the device has failed to register.

Actual behavior:

register() promise never resolves.

Software versions:

  • Browser(s): 120.0.6099.109
  • Operating System: MacOS 13.5.2 (22G91)
  • twilio.js: 2.8.0
  • Third-party libraries (e.g., Angular, React, etc.): React
@charliesantos
Copy link
Collaborator

Good find @kamalbennani ! Thanks for submitting. I created an internal ticket to have the associated PR reviewed and tested further.

@charliesantos
Copy link
Collaborator

fixed in 2.10.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jira added
Projects
None yet
Development

No branches or pull requests

2 participants