Comments (3)
it works in http,but when i set my cluster to my grpc server i got this error
client -> envoy(wasm)-> grpc server
from proxy-wasm-cpp-sdk.
my wasm code is
#include <string>
#include <string_view>
#include <unordered_map>
#include "proxy_wasm_intrinsics.h"
class ExampleRootContext : public RootContext {
public:
explicit ExampleRootContext(uint32_t id, std::string_view root_id) : RootContext(id, root_id) {}
bool onStart(size_t) override;
bool onConfigure(size_t) override;
void onTick() override;
};
class ExampleContext : public Context {
public:
explicit ExampleContext(uint32_t id, RootContext* root) : Context(id, root) {}
void onCreate() override;
FilterHeadersStatus onRequestHeaders(uint32_t headers, bool end_of_stream) override;
FilterDataStatus onRequestBody(size_t body_buffer_length, bool end_of_stream) override;
FilterHeadersStatus onResponseHeaders(uint32_t headers, bool end_of_stream) override;
FilterDataStatus onResponseBody(size_t body_buffer_length, bool end_of_stream) override;
void onDone() override;
void onLog() override;
void onDelete() override;
};
static RegisterContextFactory register_ExampleContext(CONTEXT_FACTORY(ExampleContext),
ROOT_FACTORY(ExampleRootContext),
"my_root_id");
bool ExampleRootContext::onStart(size_t) {
LOG_TRACE("onStart");
return true;
}
bool ExampleRootContext::onConfigure(size_t) {
LOG_TRACE("onConfigure");
proxy_set_tick_period_milliseconds(1000); // 1 sec
return true;
}
void ExampleRootContext::onTick() { LOG_TRACE("onTick"); }
void ExampleContext::onCreate() { LOG_WARN(std::string("onCreate " + std::to_string(id()))); }
FilterHeadersStatus ExampleContext::onRequestHeaders(uint32_t, bool) {
LOG_DEBUG(std::string("onRequestHeaders ") + std::to_string(id()));
auto result = getRequestHeaderPairs();
auto pairs = result->pairs();
LOG_INFO(std::string("headers: ") + std::to_string(pairs.size()));
for (auto& p : pairs) {
LOG_INFO(std::string(p.first) + std::string(" -> ") + std::string(p.second));
}
return FilterHeadersStatus::Continue;
}
FilterHeadersStatus ExampleContext::onResponseHeaders(uint32_t, bool) {
LOG_DEBUG(std::string("onResponseHeaders ") + std::to_string(id()));
auto result = getResponseHeaderPairs();
auto pairs = result->pairs();
LOG_INFO(std::string("headers: ") + std::to_string(pairs.size()));
for (auto& p : pairs) {
LOG_INFO(std::string(p.first) + std::string(" -> ") + std::string(p.second));
}
return FilterHeadersStatus::Continue;
}
FilterDataStatus ExampleContext::onRequestBody(size_t body_buffer_length,
bool /* end_of_stream */) {
auto body = getBufferBytes(WasmBufferType::HttpRequestBody, 0, body_buffer_length);
LOG_ERROR(std::string("onRequestBody ") + std::string(body->view()));
return FilterDataStatus::Continue;
}
FilterDataStatus ExampleContext::onResponseBody(size_t /* body_buffer_length */,
bool /* end_of_stream */) {
setBuffer(WasmBufferType::HttpResponseBody, 0, 17, "Hello, Wasm world");
return FilterDataStatus::Continue;
}
void ExampleContext::onDone() { LOG_WARN(std::string("onDone " + std::to_string(id()))); }
void ExampleContext::onLog() { LOG_WARN(std::string("onLog " + std::to_string(id()))); }
void ExampleContext::onDelete() { LOG_WARN(std::string("onDelete " + std::to_string(id()))); }
from proxy-wasm-cpp-sdk.
solve by add clusters http2 option
http2_protocol_options:
max_concurrent_streams: 100
from proxy-wasm-cpp-sdk.
Related Issues (20)
- The function proxy_get_configuration() should be removed from the SDK
- Build failing in `envoyproxy/envoy-build-ubuntu:49aaeb8f5473f09b4ab37ef3233a5e8afb7f9ed8-arm64`
- Using an external library (in my case, librdkafka) HOT 3
- Is it possible to get underlying socket? HOT 1
- Support for exceptions .. Disabling emscripten-cxx-exceptions HOT 6
- wasm-ld: error: /sdk/libprotobuf.a(common.o): undefined symbol HOT 2
- Failed to load Wasm module due to a missing import: env.getaddrinfo
- does it support grpc decode? HOT 1
- Build wasm(libprotobuf.a failed with undefined symbol(std::__2::__basic_string_common<true>::__throw_length_error() const) HOT 2
- How to modify HTTP header "Content-Length" in onRequestBody/onResponseBody HOT 2
- Can Call onRequestTrailers() and onResponseTrailers unconditionally??? HOT 1
- You can use -flto in cflags for emsdk bazel
- Fix Bazel build with emsdk 3.1.7 HOT 2
- Consider implementing Wasm-side log level
- LOG macro conflicts HOT 4
- docker build error HOT 3
- How to resume filters after returning StopIteration in onRequestHeaders()? HOT 2
- Update protobuf libraries HOT 2
- Error building building example WASM filter HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proxy-wasm-cpp-sdk.