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

Fix baseUrl without // mangling request URL on Node.js with HTTP/2 #1220

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/connect-node/src/node-universal-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function h2Request(
options: Omit<http2.ClientSessionRequestOptions, "signal">,
onStream: (stream: http2.ClientHttp2Stream) => void,
): void {
const requestUrl = new URL(url, sm.authority);
const requestUrl = new URL(url);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The URL constructor parses https:localhost:8443, but not when the base argument is given.

The result here used to be https://localhost:8443/localhost:8443/connectrpc.eliza.v1.ElizaService/Introduce, and is now the expected https://localhost:8443/connectrpc.eliza.v1.ElizaService/Introduce.

IIRC, the authority was only given as a base to potentially support relative URLs, but I don't actually see us supporting them in a meaningful way with this HTTP client.

if (requestUrl.origin !== sm.authority) {
const message = `cannot make a request to ${requestUrl.origin}: the http2 session is connected to ${sm.authority}`;
sentinel.reject(new ConnectError(message, Code.Internal));
Expand Down