fix: import public causes AssertionError
See original GitHub issueThis works fine:
import "models/health_check_response_pb.proto";
This one crashes protoc:
import public "models/health_check_response_pb.proto";
Logs:
> Executing task: yarn run proto:protoc-gen-ts <
yarn run v1.19.0
$ yarn run grpc_tools_node_protoc --plugin=protoc-gen-ts=../../node_modules/.bin/protoc-gen-ts --ts_out=grpc_js:./src/main/typescript/generated/proto/protoc-gen-ts/ --proto_path ./src/main/proto/generated/openapi/ --proto_path ./src/main/proto/generated/openapi/models/ --proto_path ./src/main/proto/generated/openapi/services/ ./src/main/proto/generated/openapi/models/*.proto ./src/main/proto/generated/openapi/services/*.proto
$ /******/node_modules/.bin/grpc_tools_node_protoc --plugin=protoc-gen-ts=../../node_modules/.bin/protoc-gen-ts --ts_out=grpc_js:./src/main/typescript/generated/proto/protoc-gen-ts/ --proto_path ./src/main/proto/generated/openapi/ --proto_path ./src/main/proto/generated/openapi/models/ --proto_path ./src/main/proto/generated/openapi/services/ ./src/main/proto/generated/openapi/models/health_check_response_pb.proto ./src/main/proto/generated/openapi/models/memory_usage_pb.proto ./src/main/proto/generated/openapi/services/default_service.proto
/******/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.inherits(goog.asserts.AssertionError,goog.debug.Error);goog.asserts.AssertionError.prototype.name="AssertionError";goog.asserts.DEFAULT_ERROR_HANDLER=function(a){throw a;};goog.asserts.errorHandler_=goog.asserts.DEFAULT_ERROR_HANDLER;
Error [AssertionError]: Assertion failed
at new goog.asserts.AssertionError (/******/node_modules/google-protobuf/google-protobuf.js:81:876)
at Object.goog.asserts.doAssertFailure_ (/******/node_modules/google-protobuf/google-protobuf.js:82:257)
at Object.goog.asserts.assert (/******/node_modules/google-protobuf/google-protobuf.js:83:83)
at jspb.BinaryReader.readPackedField_ (/******/node_modules/google-protobuf/google-protobuf.js:398:249)
at jspb.BinaryReader.readPackedInt32 (/******/node_modules/google-protobuf/google-protobuf.js:399:68)
at Function.deserialize (/******/node_modules/protoc-gen-ts/src/compiler/descriptor.js:233:56)
at /******/node_modules/protoc-gen-ts/src/compiler/plugin.js:193:151
at jspb.BinaryReader.readMessage (/******/node_modules/google-protobuf/google-protobuf.js:385:329)
at Function.deserialize (/******/node_modules/protoc-gen-ts/src/compiler/plugin.js:193:28)
at Object.<anonymous> (/******/node_modules/protoc-gen-ts/src/index.js:22:45) {
reportErrorToServer: true,
messagePattern: 'Assertion failed'
}
--ts_out: protoc-gen-ts: Plugin failed with status code 1.
/******/node_modules/grpc-tools/bin/protoc.js:41
throw error;
^
Error: Command failed: /******/node_modules/grpc-tools/bin/protoc --plugin=protoc-gen-grpc=/******/node_modules/grpc-tools/bin/grpc_node_plugin --plugin=protoc-gen-ts=../../node_modules/.bin/protoc-gen-ts --ts_out=grpc_js:./src/main/typescript/generated/proto/protoc-gen-ts/ --proto_path ./src/main/proto/generated/openapi/ --proto_path ./src/main/proto/generated/openapi/models/ --proto_path ./src/main/proto/generated/openapi/services/ ./src/main/proto/generated/openapi/models/health_check_response_pb.proto ./src/main/proto/generated/openapi/models/memory_usage_pb.proto ./src/main/proto/generated/openapi/services/default_service.proto
/******/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.inherits(goog.asserts.AssertionError,goog.debug.Error);goog.asserts.AssertionError.prototype.name="AssertionError";goog.asserts.DEFAULT_ERROR_HANDLER=function(a){throw a;};goog.asserts.errorHandler_=goog.asserts.DEFAULT_ERROR_HANDLER;
Error [AssertionError]: Assertion failed
at new goog.asserts.AssertionError (/******/node_modules/google-protobuf/google-protobuf.js:81:876)
at Object.goog.asserts.doAssertFailure_ (/******/node_modules/google-protobuf/google-protobuf.js:82:257)
at Object.goog.asserts.assert (/******/node_modules/google-protobuf/google-protobuf.js:83:83)
at jspb.BinaryReader.readPackedField_ (/******/node_modules/google-protobuf/google-protobuf.js:398:249)
at jspb.BinaryReader.readPackedInt32 (/******/node_modules/google-protobuf/google-protobuf.js:399:68)
at Function.deserialize (/******/node_modules/protoc-gen-ts/src/compiler/descriptor.js:233:56)
at /******/node_modules/protoc-gen-ts/src/compiler/plugin.js:193:151
at jspb.BinaryReader.readMessage (/******/node_modules/google-protobuf/google-protobuf.js:385:329)
at Function.deserialize (/******/node_modules/protoc-gen-ts/src/compiler/plugin.js:193:28)
at Object.<anonymous> (/******/node_modules/protoc-gen-ts/src/index.js:22:45) {
reportErrorToServer: true,
messagePattern: 'Assertion failed'
}
--ts_out: protoc-gen-ts: Plugin failed with status code 1.
at ChildProcess.exithandler (node:child_process:326:12)
at ChildProcess.emit (node:events:365:28)
at maybeClose (node:internal/child_process:1067:16)
at Socket.<anonymous> (node:internal/child_process:453:11)
at Socket.emit (node:events:365:28)
at Pipe.<anonymous> (node:net:661:12) {
killed: false,
code: 1,
signal: null,
cmd: '/******/node_modules/grpc-tools/bin/protoc --plugin=protoc-gen-grpc=/******/node_modules/grpc-tools/bin/grpc_node_plugin --plugin=protoc-gen-ts=../../node_modules/.bin/protoc-gen-ts --ts_out=grpc_js:./src/main/typescript/generated/proto/protoc-gen-ts/ --proto_path ./src/main/proto/generated/openapi/ --proto_path ./src/main/proto/generated/openapi/models/ --proto_path ./src/main/proto/generated/openapi/services/ ./src/main/proto/generated/openapi/models/health_check_response_pb.proto ./src/main/proto/generated/openapi/models/memory_usage_pb.proto ./src/main/proto/generated/openapi/services/default_service.proto'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The terminal process "bash '-c', 'yarn run proto:protoc-gen-ts'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Eclipse TestNG java.lang.AssertionError - Stack Overflow
I tried to fix this by removing Assertion from my project, even import of package, but an error still appears... Here is my...
Read more >AssertionError (Java Platform SE 7 ) - Oracle Help Center
Constructs a new AssertionError with the specified detail message and cause. Method Summary. Methods inherited from class java.lang.Throwable · addSuppressed, ...
Read more >What causes Assertion Error during EXPORT of glTF
I tried using Export to Extended glTF 2.0 (glb/gltf) for MSFS and that completes succesfully so my work is complete.
Read more >7. Simple statements — Python 3.11.1 documentation
This may cause the reference count for the object previously bound to the name to reach zero, ... if __debug__: if not expression:...
Read more >Python's assert: Debug and Test Your Code Like a Pro
The Syntax of the assert Statement; The AssertionError Exception ... new bugs while adding features and fixing other bugs in your code.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also seen as: protocolbuffers/protobuf-javascript#55 in js version. This is something that we definitely have to solve here.
Hey. Thank you for reporting this.
I will try to take a look this week.