Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

envoy configuration parsing error INVALID_ARGUMENT:Unexpected token

Tags:

envoyproxy

Im trying to setup a basic envoy proxy (using Docker) from the envoy documentations but I keep getting parsing error as below:

[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:238] initializing epoch 0 (hot restart version=11.104)
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:240] statically linked extensions:
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:242]   access_loggers: envoy.file_access_log,envoy.http_grpc_access_log
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:245]   filters.http: envoy.buffer,envoy.cors,envoy.csrf,envoy.ext_authz,envoy.fault,envoy.filters.http.dynamic_forward_proxy,envoy.filters.http.grpc_http1_reverse_bridge,envoy.filters.http.header_to_metadata,envoy.filters.http.jwt_authn,envoy.filters.http.original_src,envoy.filters.http.rbac,envoy.filters.http.tap,envoy.grpc_http1_bridge,envoy.grpc_json_transcoder,envoy.grpc_web,envoy.gzip,envoy.health_check,envoy.http_dynamo_filter,envoy.ip_tagging,envoy.lua,envoy.rate_limit,envoy.router,envoy.squash
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:248]   filters.listener: envoy.listener.original_dst,envoy.listener.original_src,envoy.listener.proxy_protocol,envoy.listener.tls_inspector
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:251]   filters.network: envoy.client_ssl_auth,envoy.echo,envoy.ext_authz,envoy.filters.network.dubbo_proxy,envoy.filters.network.mysql_proxy,envoy.filters.network.rbac,envoy.filters.network.sni_cluster,envoy.filters.network.thrift_proxy,envoy.filters.network.zookeeper_proxy,envoy.http_connection_manager,envoy.mongo_proxy,envoy.ratelimit,envoy.redis_proxy,envoy.tcp_proxy
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:253]   stat_sinks: envoy.dog_statsd,envoy.metrics_service,envoy.stat_sinks.hystrix,envoy.statsd
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:255]   tracers: envoy.dynamic.ot,envoy.lightstep,envoy.tracers.datadog,envoy.tracers.opencensus,envoy.zipkin
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:258]   transport_sockets.downstream: envoy.transport_sockets.alts,envoy.transport_sockets.tap,raw_buffer,tls
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:261]   transport_sockets.upstream: envoy.transport_sockets.alts,envoy.transport_sockets.tap,raw_buffer,tls
[2019-09-30 11:16:05.313][1][info][main] [source/server/server.cc:267] buffer implementation: old (libevent)
[2019-09-30 11:16:05.318][1][critical][main] [source/server/server.cc:93] error initializing configuration '/etc/envoy/envoy.yml': Unable to parse JSON as proto (INVALID_ARGUMENT:Unexpected token.
admin:
  access_log
^): admin:
  access_log_path: /tmp/admin_access.log
  address:
    socket_address: { address: 127.0.0.1, port_value: 9901 }

static_resources:
  listeners:
  - name: listener_0
    address:
      socket_address: { address: 127.0.0.1, port_value: 10000 }
    filter_chains:
    - filters:

As you can see it is JSON to Proto parsing error however I don't know where I have devated from the docs on the website. Unless the docs are out of date! Below is my envoy.yml file:

admin:
  access_log_path: /tmp/admin_access.log
  address:
    socket_address: { address: 127.0.0.1, port_value: 9901 }

static_resources:
  listeners:
  - name: listener_0
    address:
      socket_address: { address: 127.0.0.1, port_value: 10000 }
    filter_chains:
    - filters:
      - name: envoy.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
          stat_prefix: ingress_http
          codec_type: AUTO
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains: ["*"]
              routes:
              - match: { prefix: "/" }
                route: { cluster: some_service }
          http_filters:
          - name: envoy.router
  clusters:
  - name: some_service
    connect_timeout: 0.25s
    type: STATIC
    lb_policy: ROUND_ROBIN
    load_assignment:
      cluster_name: some_service
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: 127.0.0.1
                port_value: 1234

And this is the envoy part of my docker-compose file:

 envoy:
    image: envoyproxy/envoy:v1.11.1
    command: /usr/local/bin/envoy -c /etc/envoy/envoy.yml -l debug --service-cluster proxy
    container_name: envoy
    ports:
      - 8070:12000
    volumes:
      - ./scripts/envoy/envoy.yml:/etc/envoy/envoy.yml
    networks:
      - mongo-cluster
like image 661
Omid S Avatar asked Sep 30 '19 11:09

Omid S


1 Answers

Found the problem, I was being silly, I knew I must being silly but couldn't figure it out till I posted the question lol.

The problem was to do with my yaml file extension name. Instead of .YAML I was using .YML I don't know why VS Code recognized the extension which put me off.

like image 59
Omid S Avatar answered Nov 15 '22 07:11

Omid S