Skip to content

Add gRPC-Web module#403

Open
DorianNiemiecSVRJS wants to merge 9 commits intodevelop-2.xfrom
feature/grpcweb
Open

Add gRPC-Web module#403
DorianNiemiecSVRJS wants to merge 9 commits intodevelop-2.xfrom
feature/grpcweb

Conversation

@DorianNiemiecSVRJS
Copy link
Member

This pull request would add a module that translates gRPC-Web requests into gRPC.

This module can be useful for exposing gRPC APIs when the clients only support HTTP. gRPC-Web would act as a bridge between HTTP clients and gRPC backends.

@DorianNiemiecSVRJS
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d513b09309

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

// Safety: There's a safety warning in the `SyncTonicBody` struct's constructor.
unsafe impl Sync for SyncTonicBody {}

Choose a reason for hiding this comment

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

P1 Badge Remove unsound Sync impl for tonic body wrapper

SyncTonicBody is marked Sync even though it wraps tonic::body::Body, which is intentionally not Sync; this bypasses Rust’s thread-safety guarantees and can lead to undefined behavior on multithreaded runtimes if the body is shared across threads (or if tonic internals change). This should be implemented without asserting Sync manually (for example by using an unsync body path) rather than relying on unchecked unsafe.

Useful? React with 👍 / 👎.

biased;

response = &mut call_future => {
let (response_parts, _) = response?.into_parts();

Choose a reason for hiding this comment

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

P2 Badge Preserve short-circuit grpc-web responses instead of dropping body

When GrpcWebLayer handles a request without forwarding to the inner service, this branch keeps only status/headers and discards the returned body; Ferron then synthesizes its own generic response body later, which changes grpc-web/cors behavior and can break clients expecting the layer-generated payload. Returning the full response here avoids losing protocol-specific content.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant