AssertionError: Assertion failed when deserializing message from python in js
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, node.js, python
- Ambito
- backend-api-design
Direzione di ricerca
Inizia dal repository di esempio collegato ed esegui node test.js e python3 test.py dopo aver installato i relativi requisiti. Confronta il percorso di deserializzazione in demo_pb.js con il risultato Python, usando la sequenza di byte e lo stack trace riportati come riproduzione. L’attività è completata quando il messaggio viene deserializzato correttamente sia in JavaScript sia in Python senza l’AssertionError.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What version of protobuf and what language are you using?
Version: v.3.11.2
Language: Python, Javascript
What operating system (Linux, Windows, ...) and version?
MacOS High Sierra Version 10.13.6
What runtime / compiler are you using (e.g., python version or gcc version)
Python 3.7.3, NodeJS v13.3.0
What did you do?
Steps to reproduce the behavior:
- Defined these protos:
syntax = "proto2";
message B {
optional string b2 = 2;
}
message A {
optional B b = 1;
optional string id = 2;
}
- Attempted to deserialize this message in both js and python:
0a060a0131120131181e10a3c6ad8dcdeed0a274
Here's a sample repo to reproduce: https://github.com/bhainesva/protobuf-py-vs-js-demo (run node test.js / python3 test.py after installing requirements).
What did you expect to see
I expected the deserialization to succeed in both python and js.
What did you see instead?
Python deserialization succeeds but js deserialization produces this error:
/Users/bhaines/repo/proto-demo/node_modules/google-protobuf/google-protobuf.js:81
jspb.BinaryConstants.TWO_TO_32=4294967296;jspb.BinaryConstants.TWO_TO_52=4503599627370496;jspb.BinaryConstants.TWO_TO_63=0x7fffffffffffffff;jspb.BinaryConstants.TWO_TO_64=1.8446744073709552E19;jspb.BinaryConstants.ZERO_HASH="\x00\x00\x00\x00\x00\x00\x00\x00";goog.dom={};goog.dom.NodeType={ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12};goog.debug={};goog.debug.Error=function(a){if(Error.captureStackTrace)Error.captureStackTrace(this,goog.debug.Error);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a));this.reportErrorToServer=!0};goog.inherits(goog.debug.Error,Error);goog.debug.Error.prototype.name="CustomError";goog.asserts={};goog.asserts.ENABLE_ASSERTS=goog.DEBUG;goog.asserts.AssertionError=function(a,b){goog.debug.Error.call(this,goog.asserts.subs_(a,b));this.messagePattern=a};goog.in
Error [AssertionError]: Assertion failed
at new goog.asserts.AssertionError (/Users/bhaines/repo/proto-demo/node_modules/google-protobuf/google-protobuf.js:81:876)
at Object.goog.asserts.doAssertFailure_ (/Users/bhaines/repo/proto-demo/node_modules/google-protobuf/google-protobuf.js:82:257)
at Object.goog.asserts.assert (/Users/bhaines/repo/proto-demo/node_modules/google-protobuf/google-protobuf.js:83:83)
at jspb.BinaryReader.readString (/Users/bhaines/repo/proto-demo/node_modules/google-protobuf/google-protobuf.js:394:64)
at Function.proto.A.deserializeBinaryFromReader (/Users/bhaines/repo/proto-demo/demo_pb.js:263:49)
at Function.proto.A.deserializeBinary (/Users/bhaines/repo/proto-demo/demo_pb.js:239:18)
at Object.<anonymous> (/Users/bhaines/repo/proto-demo/test.js:13:20)
at Module._compile (internal/modules/cjs/loader.js:1128:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:983:32) {
message: 'Assertion failed',
reportErrorToServer: true,
messagePattern: 'Assertion failed'
}
Seems related to including unknown fields in messages but I'm not very familiar with protobuf, my understanding is that that's supported.
Potentially related to this issue? protocolbuffers/protobuf#4688.
- Lingua principale
- JavaScript
- Stelle
- 471
- Fork
- 91
- Merge medio
- 3h 57m
- PR unite (30g)
- 2
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di protocolbuffers/protobuf-javascript
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
protocolbuffers/protobuf-javascript#248 · 1 commento · 13 reazioni ·
-
question
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
protocolbuffers/protobuf-javascript#222 · 9 commenti ·
-
Why map.js sort keys? Apertaenhancement port-fix triaged
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
protocolbuffers/protobuf-javascript#185 · 1 commento ·
-
enhancement port-fix triaged
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
protocolbuffers/protobuf-javascript#182 · 3 commenti · 1 reazione ·
Tutte le issue di protocolbuffers/protobuf-javascript
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
avniproject/avni-client#2135 ·
-
automated broken-link
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
agent/security hive/hosted-available-lke648397-260827-5n31 security
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bevyengine/bevy-website#2595 ·