Giter VIP home page Giter VIP logo

envoy-demo's People

Contributors

chrispine avatar dependabot[bot] avatar jchadwick-buf avatar smallsamantha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

envoy-demo's Issues

Error when migrate to connect_grpc_bridge (google.protobuf.message.DecodeError)

Hello,
I am trying to migrate my project on buf connect and I have the following error in my browser console.

My grpc framework is based on django and https://github.com/socotecio/django-socio-grpc
My envoy layer is up to 1.26

Below my front use case:

import { createPromiseClient } from "@connectrpc/connect";
import { createConnectTransport } from "@connectrpc/connect-web";

import { UserController } from './proto/js/sample_back/user_connect'
import { UserListRequest } from './proto/js/sample_back/user_pb'


// This transport is going to be used throughout the app
const transport = createConnectTransport({
  baseUrl: "http://localhost:20251",
});


async function user_list_test(auth) {
  const request = new UserListRequest();
  const headers = new Headers();
  const promiseClient = createPromiseClient(UserController, transport);

  headers.set("Headers", JSON.stringify(
    {
      "Authorization": `Bearer ${auth.userData.access_token}`
    }
  ))

  const res = await promiseClient.list(
    request,
    {
      headers: headers
    }
  );
}

Bellow the browser error:
image

Bellow my envoy.yaml:

admin:
  address:
    socket_address: { address: 0.0.0.0, port_value: 9090 }

static_resources:
  listeners:
  - name: listener_0
    address:
      socket_address: { address: 0.0.0.0, port_value: 20251 }
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          stat_prefix: ingress_http
          access_log:
          - name: envoy.access_loggers.stdout
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog
          - name: envoy.access_loggers.stderr
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StderrAccessLog
          codec_type: AUTO
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains: ["*"]
              routes:
              - match: { prefix: "/" }
                route: { cluster: service_0 }
              cors:
                allow_origin_string_match:
                - prefix: "*"
                allow_methods: GET, PUT, DELETE, POST, OPTIONS
                allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout,filters,pagination,headers,connect-protocol-version
                max_age: "1728000"
                expose_headers: custom-header-1,grpc-status,grpc-message,filters,pagination,headers,connect-protocol-version
          http_filters:
          - name: envoy.filters.http.connect_grpc_bridge
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.connect_grpc_bridge.v3.FilterConfig
          - name: envoy.filters.http.grpc_web
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.grpc_web.v3.GrpcWeb
          - name: envoy.filters.http.cors
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.Cors
          - name: envoy.filters.http.router
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
  clusters:
  - name: service_0
    connect_timeout: 0.25s
    type: STRICT_DNS
    lb_policy: ROUND_ROBIN
    load_assignment:
      cluster_name: service_0
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: sample-back-grpc
                port_value: 50051
    typed_extension_protocol_options:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        explicit_http_config:
          http2_protocol_options:
            max_concurrent_streams: 100

The only envoy log I have:
image

Any help on this issue ?

Best regards,
Max

Filter not working with Python grpc servers

Hi,
I have been trying to set up this filter to handle Connect web messages in a Python gRPC server and it looks like it doesn't work.

The buf curl command does work, but making a call with a Connect Transport in a web browser always returns a 503 UC (unavailable). Using the GrpcWeb Transport works. The Go example works for both grpcWeb and connect as expected.

The error Python side are things like :

DEBUG:grpclib.protocol:Protocol error
Traceback (most recent call last):
  File "/root/.cache/pypoetry/virtualenvs/pyserv-MATOk_fk-py3.10/lib/python3.10/site-packages/grpclib/protocol.py", line 714, in data_received
    events = self.connection.feed(data)
  File "/root/.cache/pypoetry/virtualenvs/pyserv-MATOk_fk-py3.10/lib/python3.10/site-packages/grpclib/protocol.py", line 189, in feed
    return self._connection.receive_data(data)  # type: ignore
  File "/root/.cache/pypoetry/virtualenvs/pyserv-MATOk_fk-py3.10/lib/python3.10/site-packages/h2/connection.py", line 1463, in receive_data
    events.extend(self._receive_frame(frame))
  File "/root/.cache/pypoetry/virtualenvs/pyserv-MATOk_fk-py3.10/lib/python3.10/site-packages/h2/connection.py", line 1487, in _receive_frame
    frames, events = self._frame_dispatch_table[frame.__class__](frame)
  File "/root/.cache/pypoetry/virtualenvs/pyserv-MATOk_fk-py3.10/lib/python3.10/site-packages/h2/connection.py", line 1682, in _receive_data_frame
    frames, stream_events = stream.receive_data(
  File "/root/.cache/pypoetry/virtualenvs/pyserv-MATOk_fk-py3.10/lib/python3.10/site-packages/h2/stream.py", line 1073, in receive_data
    self._track_content_length(len(data), end_stream)
  File "/root/.cache/pypoetry/virtualenvs/pyserv-MATOk_fk-py3.10/lib/python3.10/site-packages/h2/stream.py", line 1340, in _track_content_length
    raise InvalidBodyLengthError(expected, actual)
h2.exceptions.InvalidBodyLengthError: InvalidBodyLengthError: Expected 2 bytes, received 7

I use a https://github.com/vmagamedov/grpclib server (which uses https://github.com/python-hyper/h2 under the hood) but I also tried with the official grpc lib with the same results.

Are you aware of a weird behavior in python grpc implementation that would cause this ?

Here is my fork with a python server + a connect-example with buttons to make calls https://github.com/legau/envoy-demo

Thanks

Transcode plaintext to binary requests

Thank you for your great work and great project.

I have a betterproto+grpclib server backend (i.e. in Python) and was having a hard time debugging grpc-web requests as all communications were binary. I switched to connectRPC, motivated by the much better support for typescript browser code and plaintext requests.

However, after setting up the connect <-> gRPC envoy bridge as demonstrated in this repo, I have realised that plaintext connect requests are not transcoded to binary gRPC. My backend does not support JSON requests, so I am stuck using connect with binary format, thus losing the benefits from using connect in the first place.

Is adding a feature request in envoy to support this transcoding in the bridge the right approach? Do you know of a way to solve this in the short term, e.g. plugging in some additional envoy filter in the stack? I've tried using Envoy's grpc json transcoder, but without success.

Add a k8s manifest/kustomize example.

Many of us have standardized on k8s for deploying things like this as that's how the ultimate production etc. environments are orchestrated.

Ideally demos like these would be setup for k8s rather than docker-compose which only really works locally.

Add link to ready-to-use docker image

Dear Buf team,
first of all I want to thank you for all the effort you put into the gRPC/Protobuf ecosystem!

With the help of the example provided in this repo, I created a project that provides a ready-to-use proxy server via a Docker image: https://github.com/mirkolenz/grpc-proxy

I would like to ask if you could consider adding a link to my repo in the README of this demo. The goal of my project is to make using the required envoy proxy easier and I think it could benefit from a bit more visibility.

I can totally understand if you do not want to link to a third-party repo. In this case, feel free to close this issue.

Keep up your great work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.