Velz
Velz4mo ago

App stuck reconnecting via websocket

Hi folks, I have been migrating my pet project over to convex and everything has been smooth so far. However, all of the sudden, my app (react) no longer seems to be able to connect to the dashboard via websocket. It keeps trying to "sync" in the network tab (see screenshot) but it never succeeds connecting, just stuck in an infinite loop of re-trying. Here's response headers from one of the connection attempts:
HTTP/1.1 101 Switching Protocols
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: http://localhost:5173
Connection: upgrade
Date: Fri, 20 Sep 2024 02:08:28 GMT
Sec-Websocket-Accept: xMcIagumTDTLcHkxakqzc/BYzVo=
Upgrade: websocket
Vary: origin, access-control-request-method, access-control-request-headers
HTTP/1.1 101 Switching Protocols
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: http://localhost:5173
Connection: upgrade
Date: Fri, 20 Sep 2024 02:08:28 GMT
Sec-Websocket-Accept: xMcIagumTDTLcHkxakqzc/BYzVo=
Upgrade: websocket
Vary: origin, access-control-request-method, access-control-request-headers
Not sure how to troubleshoot. I even attempted to re-create the project but no luck. Thanks in advance!
No description
19 Replies
Convex Bot
Convex Bot4mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Ask in the <#1228095053885476985> channel to get a response from <@1072591948499664996>. - Avoid tagging staff unless specifically instructed. Thank you!
Velz
VelzOP4mo ago
More context: * I tried to switch networks (from wifi to a hot-spot), but no luck. * I also tried different browser to eliminate any possibilities of things being suddenly blocked by an extension or something similar - no luck * CLI works without problems: functions/schema sync correctly, I can run functions via the dashboard without problems Not sure if related, but before these issues started, my project's development env stopped loading at all. I could not resolve it, but re-creating the project fixed it.
ballingt
ballingt4mo ago
development env stopped loading at all.
meaning the dashboard? What's the name of your backend? (soething like "happy-otter-123")
Velz
VelzOP4mo ago
yes, the dashboard. I just kept getting infinite loading spinner and if I remember correctly, the browser's console was complaining about connecting to the socket. Unfortunately in my attempts to fix the situation I deleted that project and created new one (two times), so can't get the backend name for the project where dashboard got stuck. The current project's name is exciting-oyster-122. The dashboard is loading for this one, but I cannot connect from the app for some reason
djbalin
djbalin4mo ago
Are you using auth? Did you setup http.ts file correctly?
Velz
VelzOP4mo ago
no, no auth yet, just a simple schema with a function it was working fine for me, until the dashboard died on me (stuck in spinner). I deleted the project that got stuck (from the dashboard), created a new project, and re-linked my app to it. However, the app just refuses to connect
Velz
VelzOP4mo ago
it seems like connection attempts from the app get closed without a reason... the only messages within each connection are these two (after that it seems to get closed and attempts to re-connect again):
No description
No description
Velz
VelzOP4mo ago
the app right now just executes a simple query on render, nothing more even attempted to nuke node_modules and pnpm.lockfile - no luck, same thing
lee
lee4mo ago
sorry about this. i'm trying to look for the issue on the convex side but not found anything yet. any chance you can try a different wifi network (maybe tether?), to rule out a network issue?
Velz
VelzOP4mo ago
thanks! I tried that yesterday, but got same thing. Let me try again just to double-check nope, network switch did not help
lee
lee4mo ago
hmm we'll keep looking
Velz
VelzOP4mo ago
I will try create a new vite/react app and connect to this backend, see if perhaps something's going wrong with my pnpm workspaces? so... connecting from a brand new app worked like charm no issues but going back to my original app things become broken again I think I found the cause of the problem... let me write it up. Might need some advice on how to better do this
v
v4mo ago
can you give me ur project url and maybe a method you have defined i can try to connect to the WebSocket myself (i havent read everything above so excuse me)
Velz
VelzOP4mo ago
my app consists of a webapp and a chrome extension. They share data layer, so I arranged them in a pnpm workspace in a following way
packages:
- 'packages/*'
- 'apps/*'
packages:
- 'packages/*'
- 'apps/*'
apps/webapp and apps/extension contains the webapp and the extension, respectively packages/data contains data shared between both Initially I installed convex into apps/webapp (just to quickly get started) and everything worked. However, I decided to move it into packages/data so that I could re-use the types between webapp and extension. Once my initial backend hang on me (dashboard showing infinite spinner), I deleted that backend and created a new one. I updated env variables in packages/data, but failed to do so in apps/webapp (it was pointing to old non-existing URL). After I updated the env. variables in apps/webapp to point to the correct URL all is working well I suspect I might be doing silly things here... what would be the recommended way to re-use convex data types among multiple projects within a pnpm workspace?
v
v4mo ago
can you execute functions on the dashboard
Velz
VelzOP4mo ago
yep no problems with running them on dashboard I also found the cause of the issue, can run them locally now
v
v4mo ago
nice nice
Velz
VelzOP4mo ago
just messed up setup basically
lee
lee4mo ago
https://docs.convex.dev/production/multiple-repos maybe? idk about pnpm but this is how you can use the types across multiple repos
Multiple Repositories | Convex Developer Hub
Use Convex in multiple repositories

Did you find this page helpful?