@opentelemetry/otlp-transformer throw error when run in old Android webview, throw error "Cannot redefine property: name" #5096
Labels
question
User is asking a question not related to a new feature or bug
What happened?
@opentelemetry/otlp-transformer:0.52.1
When running the code that imports the current package in a low version webview(for example: Android 5.1.1; vivo X7L Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0), the error message is as follows:
Uncaught TypeError: Cannot redefine property: name
I traced the code, found the code in
node_modules/@opentelemetry/otlp-transformer/build/src/generated/root.js
Object.defineProperty(TraceService.prototype["export"] = function export_(request, callback) { return this.rpcCall(export_, $root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest, $root.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse, request, callback); }, "name", { value: "Export" });
Object.defineProperty(MetricsService.prototype["export"] = function export_(request, callback) { return this.rpcCall(export_, $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest, $root.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse, request, callback); }, "name", { value: "Export" });
Object.defineProperty(LogsService.prototype["export"] = function export_(request, callback) { return this.rpcCall(export_, $root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest, $root.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse, request, callback); }, "name", { value: "Export" });
When executing the above 3 code segments, Android low-version webview will report an error "Cannot redefine property: name" because these webviews will throw an error when the name attribute of the function is modified.
I don't know what the three lines of code do, and the code runs normally without any errors when I comment out those lines. Hi, friends, if I want to fix this problem, what should I do? Thank you very much.
Steps to Reproduce
Expected Result
Actual Result
Additional Details
OpenTelemetry Setup Code
No response
package.json
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: