Closed AbdullahQureshi1080 closed 6 months ago
Check the variables in the functions. I had the same problem before and found out that I mispelled the variables.
Check the variables in the functions. I had the same problem before and found out that I mispelled the variables.
@jmozzart For the serverless function? And in the Twilio console?
Check both.
In the serverless function
let token = new AccessToken(
context.ACCOUNT_SID,
context.TWILIO_API_KEY_SID,
context.TWILIO_API_KEY_SECRET, {
identity: event.identity,
ttl: 3600
});
let grant = new AccessToken.ChatGrant({ serviceSid: context.SERVICE_SID });
Variables (ENV)
Add my Twilio Credentials (ACCOUNT_SID) and (AUTH_TOKEN) to ENV -> This is also checked to be true.
So this is in the serverless config!
Do I have to add these variables in the demo project on the front end as well?
Since you're still offline, this means the connection did not finalize yet, you cannot create conversations while offline in the current implementation.
Since you're still offline, this means the connection did not finalize yet, you cannot create conversations while offline in the current implementation.
Understood. But how do I validate that I am alive?
The token is valid. Because the login call gives a valid token.
It's the preset demo, haven't changed anything. I thought it should work with the steps.
Can you share the quick flow and then I can try to see if there are missing things, I can then update after tweaking things at my end.
@berkus I just logged the connecting state, it starts from connecting to denied. I think that's the issue.
What could be the possible reason?
Do I have to add these variables in the demo project on the front end as well?
denied
means your token is invalid. Enable trace logging and check the error response in the logs.
You do not need to add any env variables to the frontend except the token function URL.
@berkus maybe we can change Error: Cannot read properties of undefined (reading 'then')
to a different message so it doesn't confuse anyone.
@lesquive sure, we have almost non-existing error handling in the app, there are many places where we could improve error messages and handle them gentler.
I had the same problem and this is how I have solved it. I was using wrong credentials for TWILIO_API_KEY_SID and TWILIO_API_KEY_SECRET variables. You must create a new API Key and get the right variables from it. Check it at https://console.twilio.com/us1/account/keys-credentials/api-keys and use [Create API key] button.
@GomezFabio Thanks.
I already did this. I am able to use auth but cannot create room/channel for testing the whole thing out.
And I was not able to find anything in the demo, example or the docs on how to trace my steps for the setup.
Currently putting twilio on hold, exploring other options.
I've just deployed to Vercel, followed the guide in the github readme of the demo, I also get this error when creating a new conversation:
Cannot read properties of undefined (reading 'then')
Any news on this? @AbdullahQureshi1080
edit: My app is deployed on Vercel, I saw "offline" on the top bar under my username. What do I have to do?
No update, we moved to another sdk as their solution did not fulfill our use case. Although I did try to fix these error but no luck. The documentation can be made more assistive to help. At the moment it's not. @Fabryz
On Fri, 23 Feb 2024, 3:22 am Fabrizio Codello, @.***> wrote:
I've just deployed to Vercel, followed the guide in the github readme of the demo, I also get this error when creating a new conversation:
Cannot read properties of undefined (reading 'then')
Any news on this? @AbdullahQureshi1080 https://github.com/AbdullahQureshi1080
— Reply to this email directly, view it on GitHub https://github.com/twilio/twilio-conversations-demo-react/issues/144#issuecomment-1960423732, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANJLWWQ6PC477NY7XM6PZUDYU7AJPAVCNFSM6AAAAABAI2MC6WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRQGQZDGNZTGI . You are receiving this because you were mentioned.Message ID: @.***>
My app is deployed on Vercel, I saw "offline" on the top bar under my username.
Did you set up the token generator?
My app is deployed on Vercel, I saw "offline" on the top bar under my username.
Did you set up the token generator? I've setup the two TWILIO API KEYS
Could you please tell me what I'd need to do in particular?
Could you please tell me what I'd need to do in particular?
You need to deploy a function as descibed in the README that will generate and provide you with access tokens. When deploying to vercel it shall ask you about the token generator url - you need to provide that function's url there.
@GomezFabio gave a right answer. Thank you. My problem was in the existing API key which is actually not an API key at all.
https://console.twilio.com/us1/account/keys-credentials/api-keys This page has two sections.
There was a live auth token which I already used before this demo application and this auth token didn't work.
Now I've created a new API key. I've updated my env variables in the cloud function and everything works now. The status is set to "online" after the initial sign in.
@Fabryz FYI
I guess we're all sorted here. Closing.
I was trying to test the demo out, after having done the initial steps and setting up the serverless functions. I can log in and build the app successfully. However, I cannot create a new conversation.
Error: Cannot read properties of undefined (reading 'then')
It's this function
Note: I am using the serverless functions for the backend.
Node: v18
Use the steps here to set up the service.
I have gone through the other issues, not that helpful. Anyone who's been able to get throught this, I'd appreciate the support.