-
Notifications
You must be signed in to change notification settings - Fork 48
Always include cookies when communicating with signaling server #629
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
Always include cookies when communicating with signaling server #629
Conversation
Test is failing because it's trying to connect to directly to viam-typescript-sdk/src/rpc/dial.ts Lines 132 to 137 in 32e1d63
Update: I made it set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR should work as-is in production, however for local development, an App running on http[s]://localhost:8080 will be unable to send the session-id cookie required for authentication to a Signaling server running on http[s]://localhost:8081, because localhost:* are considered different origins.
Help me understand this. Where does this leave people currently trying to develop against a local app? Will it break existing local-only workflows? Is this a permanent change, or only temporary while the rest of the project completes?
I believe this can be merged now without impacting anyone because:
After this PR is merged, I need to bump the version in the Svelte SDK, then bump the Svelte SDK version in App. The correct TS SDK version that App's RobotClients need is embedded in App, so users can pull the latest App at their own convenience. |
I thought the |
What do you mean by wouldn't work? Ignored? On the current Main branch in App (App & Signaling both on In my local dev branch (App on |
(spoke with @aldenh-viam in-person, got clarification!) |
🔗 Link your GitHub account to AtlassianTo enable Code Reviewer, please link your GitHub account to your Atlassian account. Click here to connect your accounts This is a one-time setup that takes less than a minute. |
We're working on moving Signaling into a separate process from the rest of App: APP-8915
The above linked PR in App should work as-is in production.
In local development, until this PR is also merged, an App running on
http[s]://localhost:8080
will be unable to send thesession-id
cookie required for authentication to a Signaling server running onhttp[s]://localhost:8081
, becauselocalhost:*
are considered different origins. This PR changes the fetch request'scredentials
property from the defaultsame-origin
toinclude
if the specifiedserviceHost
different from thesignalingAddress
(otherwise you may be bypassing App and connecting directly to the robot's internal signaling server, like in the E2E test).This should not have any effect on the current production, because
*.viam.com:443/*
is considered same-origin and cookies are already included with the fetch requests.This approach seems simpler than setting up a reverse proxy like Envoy for local development or changing the RobotClient used by App (for the machine liveness dropdown & control tab) to authenticate using API keys instead of the
session-id
cookie, but let me know if you feel differently.Current:
http[s]://localhost:8080
http[s]://localhost:8080
https://app.viam.com:443
https://app.viam.com:443
After APP-8915 + this PR:
http[s]://localhost:8080
http[s]://localhost:8081
https://app.viam.com:443
https://app.viam.com:443