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

core_1.ExportResultCode does not exist #252

Closed
thespacedeck opened this issue Mar 30, 2021 · 3 comments · Fixed by #274
Closed

core_1.ExportResultCode does not exist #252

thespacedeck opened this issue Mar 30, 2021 · 3 comments · Fixed by #274
Labels
bug Something isn't working

Comments

@thespacedeck
Copy link

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

^0.9.0

What version of Node are you using?

v12.19.1

What did you do?

If possible, provide a recipe for reproducing the error.

const opentelemetry = require("@opentelemetry/api");
const { TraceExporter } = require('@google-cloud/opentelemetry-cloud-trace-exporter');
const { NodeTracerProvider } = require("@opentelemetry/node");
const { BatchSpanProcessor } = require("@opentelemetry/tracing");

const provider = new NodeTracerProvider();
provider.register();

const exporter = new TraceExporter();

provider.addSpanProcessor(new BatchSpanProcessor(exporter));

--->
const span = tracer.startSpan().updateName("new_span");
...run logic...
span.end()

What did you expect to see?

Expected no error

What did you see instead?

TypeError: Cannot read property 'FAILED' of undefined
/@google-cloud/opentelemetry-cloud-trace-exporter/build/src/trace.js:95:52)

relates to ln 92 error.message => Cannot read property 'SUCCESS' of undefined

Additional context

I think core_1.ExportResultCode does not exist, only core_1.ExportResult does.

core_1.ExportResult looks like this:
{
'0': 'SUCCESS',
'1': 'FAILED_NOT_RETRYABLE',
'2': 'FAILED_RETRYABLE',
SUCCESS: 0,
FAILED_NOT_RETRYABLE: 1,
FAILED_RETRYABLE: 2
}

@thespacedeck thespacedeck added the bug Something isn't working label Mar 30, 2021
@weyert
Copy link

weyert commented Apr 1, 2021

Make sure you are using 0.18+ of Opentelemetry-js based on the error it looks like you are using an older version. See: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-core/src/ExportResult.ts.

You might be having something that brings in 0.12. Do you happen to use @google-cloud/pubsub in the same code base? If so, you might are hitting this issue: googleapis/nodejs-pubsub#1233. To solve it you can make sure to add opentelemetry packages

@aabmass
Copy link
Contributor

aabmass commented Apr 1, 2021

Adding onto that, what version of npm are you using @thespacedeck ? If you have npm 7, it should have complained to you about unsupported peerDependency

@weyert
Copy link

weyert commented Apr 15, 2021

Just wanted to let you know a new version of pubsub package got published earlier today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants