firebase / genkit

An open source framework for building AI-powered apps with familiar code-centric patterns. Genkit makes it easy to integrate, test, and deploy sophisticated AI features to Firebase or Google Cloud.
Apache License 2.0
607 stars 74 forks source link

[JS] error when trying to contribute #455

Closed cabljac closed 2 months ago

cabljac commented 2 months ago

Describe the bug

When I clone the repo and follow the contributing guide, i get an error

To Reproduce

  1. git clone ...
  2. cd genkit && pnpm i
  3. pnpm run setup

in core I get:


src/tracing.ts:61:3 - error TS2322: Type 'MultiSpanProcessor' is not assignable to type 'SpanProcessor'.
  Types of property 'onStart' are incompatible.
    Type '(span: import("/Users/jacob/genkit/js/node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.25.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/sdk-trace-base/build/src/Span").Span, parentContext: import("/Users/jacob/genkit/js/node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/src/...' is not assignable to type '(span: import("/Users/jacob/genkit/js/node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.22.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/sdk-trace-base/build/src/Span").Span, parentContext: import("/Users/jacob/genkit/js/node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/src/...'.
      Types of parameters 'span' and 'span' are incompatible.
        Type 'Span' is missing the following properties from type 'Span': addLink, addLinks

61   nodeOtelConfig.spanProcessor = new MultiSpanProcessor(processors);
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 2 errors in the same file, starting at: src/tracing.ts:60

 ELIFECYCLE  Command failed with exit code 2.
ERROR: "check" exited with 1.
/Users/jacob/genkit/js/core:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @genkit-ai/core@0.5.3 build: `npm-run-all build:clean check compile`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.
ERROR: "build" exited with 1.
 ELIFECYCLE  Command failed with exit code 1.

Expected behavior The setup to complete without error Screenshots If applicable, add screenshots to help explain your problem.

Screenshot 2024-06-24 at 08 33 37

Runtime (please complete the following information):

Get the same error when cd js/core && pnpm build

It's complaining about the following:

https://github.com/firebase/genkit/blob/main/js/core/src/tracing.ts#L60-L61

'spanProcessor' is deprecated.ts(6385)
types.d.ts(20, 9): The declaration was marked as deprecated here.
Type 'MultiSpanProcessor' is not assignable to type 'SpanProcessor'.
  Types of property 'onStart' are incompatible.
    Type '(span: import("/Users/jacob/genkit/js/node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.25.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/sdk-trace-base/build/src/Span").Span, parentContext: import("/Users/jacob/genkit/js/node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/src/...' is not assignable to type '(span: import("/Users/jacob/genkit/js/node_modules/.pnpm/@opentelemetry+sdk-trace-base@1.22.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/sdk-trace-base/build/src/Span").Span, parentContext: import("/Users/jacob/genkit/js/node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/src/...'.
      Types of parameters 'span' and 'span' are incompatible.
        Type 'Span' is missing the following properties from type 'Span': addLink, addLinksts(2322)
(property) spanProcessor?: SpanProcessor | undefined
@deprecated — use spanProcessors instead
cabljac commented 2 months ago

Seems to be a similar issue in /plugins/google-cloud for me, i think there might be an opentelemetry version mismatch or something?

MichaelDoyle commented 2 months ago

Hey @cabljac this is a duplicate of https://github.com/firebase/genkit/issues/453. You will need to make sure you are running a version of pnpm that matches the project configuration (currently 9.3.0).

Since this is coming up a few times now (inclduing internally), we'll see how we can smooth this out.

MichaelDoyle commented 2 months ago

Duplicate of https://github.com/firebase/genkit/issues/453.

cabljac commented 2 months ago

Thanks @MichaelDoyle, I think just mentioning pnpm update in CONTRIBUTING.md would totally be sufficient then

MichaelDoyle commented 2 months ago

Jacob - will do.

BTW, we found that pnpm fixed a bug where it didn't properly respect the version enforcement, leading to the original error you received. Going forward, you should only see "errors" if you upgrade ahead of the pnpm version genkit is configured for. The error should be clear in that case, and you can typically update the version/sha in the package.json to get things moving.

cabljac commented 2 months ago

Thanks for the quick response!