Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@opentelemetry/otlp-transformer throw error when run in old Android webview, throw error "Cannot redefine property: name" #5096

Open
fengyangbj-kanyun opened this issue Oct 29, 2024 · 2 comments
Labels
question User is asking a question not related to a new feature or bug

Comments

@fengyangbj-kanyun
Copy link

fengyangbj-kanyun commented Oct 29, 2024

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

@fengyangbj-kanyun fengyangbj-kanyun added bug Something isn't working triage labels Oct 29, 2024
@fengyangbj-kanyun fengyangbj-kanyun changed the title @opentelemetry/otlp-transformer throw error when run in old Android webview @opentelemetry/otlp-transformer throw error when run in old Android webview, throw error "Cannot redefine property: name" Oct 29, 2024
@dyladan dyladan added question User is asking a question not related to a new feature or bug and removed bug Something isn't working triage labels Oct 30, 2024
@dyladan
Copy link
Member

dyladan commented Oct 30, 2024

The error happens in code that is generated by the protobuf dependency required to serialize output. Unfortunately I don't know if we will be able to support such an old version of android webview as we don't have control over the protobuf code generation. Which exporter are you using?

I'm going to remove the bug label since this is an old unsupported version of android. I'll leave the issue open for now so we can hopefully find a workaround for you.

@fengyangbj-kanyun
Copy link
Author

The error happens in code that is generated by the protobuf dependency required to serialize output. Unfortunately I don't know if we will be able to support such an old version of android webview as we don't have control over the protobuf code generation. Which exporter are you using?

I'm going to remove the bug label since this is an old unsupported version of android. I'll leave the issue open for now so we can hopefully find a workaround for you.

Thank you for your reply and look forward to a workaround, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question User is asking a question not related to a new feature or bug
Projects
None yet
Development

No branches or pull requests

2 participants