Closed netanel-utila closed 2 months ago
Thanks for filing the issue. Can you share you lock file? package-lock.json
, or pnpm-lock.yaml
, or yarn.lock
?
The dependency information from package.json
is not enough. It only includes version constraints, and doesn't show if there are any peer dependency problems.
The generated content is running in a container and the versions are strict:
FROM +node
COPY --dir ./proto ./proto
COPY --dir ./vendor-proto ./vendor-proto
RUN npm i @bufbuild/buf@1.42.0 @bufbuild/protobuf@2.1.0 @bufbuild/protoc-gen-es@2.0.0-beta.3
DO +GENERATE_BUF_WORK_YAML
RUN npx @bufbuild/buf generate ./vendor-proto --template ./vendor-proto/buf.gen.js-sdk.yaml
WORKDIR /src/proto
RUN npx @bufbuild/buf build . -o ./descriptorset.binpb
RUN npx @bufbuild/buf generate ./descriptorset-filtered.binpb --template ./buf.gen.js-sdk.yaml
SAVE ARTIFACT /src/genproto/js-sdk/* AS LOCAL ./genproto/js-sdk/
You should use @bufbuild/protoc-gen-es@2.1.0
with @bufbuild/protobuf@2.1.0
, but this is not the issue. There is an older version of @bufbuild/protobuf
in play here.
Is the language server of your IDE running in the same container? It's picking up a different version of @bufbuild/protobuf
. Looks like it's 2.0.0-beta.2 or an earlier pre-release.
Here is how I can reproduce the issue with @bufbuild/protobuf
2.0.0-beta.2 and a more recent version of @bufbuild/protoc-gen-es
:
$ npx buf generate
$ npx tsc
src/gen/connectrpc/eliza/v1/eliza_pb.ts:19:15 - error TS2305: Module '"@bufbuild/protobuf/codegenv1"' has no exported member 'GenFile'.
19 import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1";
~~~~~~~
...
Updating @bufbuild/protobuf
fixes the issue:
$ npm i @bufbuild/protobuf@latest @bufbuild/protoc-gen-es@latest
removed 2 packages, changed 3 packages, and audited 11 packages in 3s
found 0 vulnerabilities
$ npx buf generate
$ npx tsc
v2.0.0-beta.3 includes https://github.com/bufbuild/protobuf-es/pull/927, which renamed the types. v2 is stable now, but pre-release versions are not.
Closing, but if it turns out it was a different issue on your end, please reopen!
Thanks, it works now. I hope that stable versions will be release soon.
Continuing this discussion here:
Hi, after changing to createClient, we don't get auto complete anymore 🤔
What am I doing wrong?