-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Typescript Encode/Decode delimited error with pbjs/pbts gencode #1063
Comments
It is possible to gen/export proto3 file from typescript messages class? |
Not resolved with v6.8.8 |
Does this also happen when using |
create instead of new, result to the same issue. Its not the same behavior like some others issues. Its seems its coming from generator process. I could copy proto file tomorrow. Thanks for the help |
I have tried just in case: import { Writer, Reader, Properties, Message } from 'protobufjs/minimal';
import { ActionMessage, HeaderMessage } from '../../../../protos/bundle.js';
let writer = Writer.create();
let header = HeaderMessage.create({type: 2, version: 0});
let action = ActionMessage.create({width: 1024, height: 1024, index: 0});
HeaderMessage.encodeDelimited(header, writer);
ActionMessage.encodeDelimited(action, writer);
let encoded = writer.finish();
let reader = Reader.create(encoded);
console.log('encode test end', HeaderMessage.decodeDelimited(reader), ActionMessage.decodeDelimited(reader)); Nothing good |
Proto file sample:
|
It happens on second (or more) "decodeDelimited" call only. |
FOUND! It's coming from encodeDelimited gencode. Wrong encodeDelimited gencode: Should be: |
Pull request |
I'm having the same trouble here while playing around with a test thing, and I'm pretty sure it's a manifestation of the same bug, but in pbjs form: The dynamically loaded proto version works fine, but the pbjs one does not. Anything I can do to help along that pull request? (edit: apologies, letting my enthusiasm run ahead of me... not remotely urgent nor a work thing) |
protobuf.js version: 6.8.6
Use pbjs to generate code from proto file (v2/v3)
pbjs -t static-module -w commonjs -o ./bundle.js ./bundle.proto && pbts -o ./bundle.d.ts ./bundle.js
Use encodeDelimited/decodeDelimited method
Try to decode message result to an error
Working with simple encode/decode
Working with single one encodeDelimited/decodeDelimited
Working with typescript decorators
Working with protobuf.load
The text was updated successfully, but these errors were encountered: