-
Notifications
You must be signed in to change notification settings - Fork 317
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
TypeError: Cannot read properties of undefined (reading 'updateToken') #152
Comments
This means your client is undefined. Probably not yet initialized. |
@berkus the client is defined. the error is thrown internally from within Client: we're using it the exact same way as in the example:
|
@kmorope pls take a look at this folks. |
Hi @aryo, I'm trying to replicate the scenario for the issue but gonna need further info on your tech stack, are you using CRA like the Twilio conversations demo app or another framework? I made some tests directly on the demo app changing the token TTL, but the client is always defined, even in cases where the TTL is defined in less than a minute. |
@kmorope Sorry for late reply, but yeah we are using CRA and the client instance lifecycle is similar to the example. A slight difference is that we have more things that can trigger another deinitialization of the client (e.g. log out etc) and we shutdown the client after removing listeners:
For completeness here's our initialization sequence +
|
We're following the example, where on
tokenAboutToExpire
we fetch a new token and callclient.updateToken
, but we're seeing a lot of these errors:We are thinking of try/catching
client.updateToken
so it doesn't die, but from reading the conversations js internals, it looks like internallyClient._fpaToken
won't get set due to the error. Would there be any bad side effects?We're on @twilio/conversations 2.4.1.
The text was updated successfully, but these errors were encountered: