Skip to content

TypeError when using protoc-gen-ts v0.8.2 with buf v1.4.0 #139

Closed
@varungandhi-src

Description

@varungandhi-src

Thank you for creating and maintaining this project.

I noticed a bug when using v0.8.2 of this project along with buf v1.4.0. I've created a repository with configuration that should help you reproduce the issue: https://github.com/varungandhi-src/protoc-gen-ts-bug (commit: 628fda220). I've copied the project's README below for convenience.

It seems like a regression that crept in some time between v0.8.1 and v0.8.2.

Unfortunately, I wasn't able to quite figure out how buf is invoking this plugin, so I don't have a minimal example without buf.


Stack trace:

/Users/varun/Code/protoc-gen-ts-bug/node_modules/protoc-gen-ts/src/index.js:60
    const { major = 0, minor = 0, patch = 0 } = request.compiler_version;
            ^

TypeError: Cannot read property 'major' of undefined
    at Object.<anonymous> (/Users/varun/Code/protoc-gen-ts-bug/node_modules/protoc-gen-ts/src/index.js:60:13)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)

Reproduction steps:

  1. Download Buf v1.4.0 from the releases.
  2. yarn --frozen-lockfile && ./buf generate, assuming that buf was put in current dir.

The bug doesn't reproduce with 0.8.1.

yarn add --dev protoc-gen-ts@0.8.1 && yarn && ./buf generate # OK

yarn add --dev protoc-gen-ts@0.8.2 && yarn && ./buf generate # FAILS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions