connectrpc / connect-es

The TypeScript implementation of Connect: Protobuf RPC that works.
https://connectrpc.com/
Apache License 2.0
1.39k stars 82 forks source link

Missing "./codegenv1" specifier in "@bufbuild/protobuf" package #1288

Closed kayn1 closed 4 weeks ago

kayn1 commented 1 month ago

Describe the bug

I can't build the project because I am getting these errors

Missing "./codegenv1" specifier in "@bufbuild/protobuf" package

Setup


{
  "private": true,
  "version": "0.1.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },
  "dependencies": {
    "@bufbuild/protobuf": "^1.10.0",
    "@bufbuild/protoc-gen-es": "^1.10.0",
    "@connectrpc/connect": "^1.4.0",
    "@connectrpc/connect-query": "1.0.0",
    "@connectrpc/connect-web": "^1.0.0",
    "@connectrpc/protoc-gen-connect-es": "^1.4.0",
    "@tanstack/react-query": "^5.59.16",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@bufbuild/buf": "^1.39.0",
    "@types/react": "^18.3.12",
    "@types/react-dom": "^18.3.1",
    "@vitejs/plugin-react": "^3.1.0",
    "typescript": "^5.1.3",
    "vite": "^4.5.5"
  }
}

<img width="529" alt="Screenshot 2024-10-26 at 23 32 53" src="https://github.com/user-attachments/assets/4fdaa7f2-212a-4617-bae9-650d59a2c888">

**To Reproduce**

Clone this repo https://github.com/kayn1/guidero
or 
Create new project with buf, generate js/ts code and try to use it with tanstack query.

**Environment (please complete the following information):**

- @connectrpc/connect-web version: (for example, `1.0.0`)
- Frontend framework and version: (`react@18.2.0`)
- Node.js version: (for example, `18.14.1`)

If your problem is specific to bundling, please also provide the following information:

- Bundler and version: (for example, `"vite": "^4.5.5"`)
-     "rollup"  "version": "3.29.5"
timostamm commented 4 weeks ago

Please make sure that you are generating code with @bufbuild/protoc-gen-es in version 1.10.0.

At the top of the generated file, there should be a line like this:

// @generated by protoc-gen-es v1.10.0 

The error message you are seeing only occurs if you generate with version 2.0.0 or later.

Your package.json has a dependency on ^1.10.0, so this shouldn't happen. Maybe a different version is installed?

Closing this, but feel free to comment if you have any questions!