Skip to content
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

Using 2.2.9 common pkg, fabproto6.google.protobuf.Timestamp.create is not a function #494

Open
gallak87 opened this issue Aug 27, 2021 · 5 comments

Comments

@gallak87
Copy link

Hi, we are running a node webapp and recently upgraded the packages fabric-common and fabric-network to 2.2.9.

We started receiving this error:

"TypeError: fabproto6.google.protobuf.Timestamp.create is not a function
    at buildCurrentTimestamp (/app/dist/node_modules/fabric-common/lib/Channel.js:553:56)
    at Channel.buildChannelHeader (/app/dist/node_modules/fabric-common/lib/Channel.js:506:15)
    at Endorsement.build (/app/dist/node_modules/fabric-common/lib/Proposal.js:291:41)
    at Transaction.submit (/app/dist/node_modules/fabric-network/lib/transaction.js:191:21)
    at MergeMapSubscriber.project (/app/dist/node_modules/@atmback-us/hlf-client/services/contracts/abstract-hlf-query-service.js:220:39)
    at MergeMapSubscriber._tryNext (/app/dist/node_modules/rxjs/internal/operators/mergeMap.js:67:27)
    at MergeMapSubscriber._next (/app/dist/node_modules/rxjs/internal/operators/mergeMap.js:57:18)
    at MergeMapSubscriber.Subscriber.next (/app/dist/node_modules/rxjs/internal/Subscriber.js:66:18)
    at TakeLastSubscriber._complete (/app/dist/node_modules/rxjs/internal/operators/takeLast.js:71:29)
    at TakeLastSubscriber.Subscriber.complete (/app/dist/node_modules/rxjs/internal/Subscriber.js:78:18)"

After debugging it, appears the .create method really is undefined. I attempted adding fabric-protos pkg directly to my repo but still got the same error.

Is there something else I'm supposed to import?

@gallak87
Copy link
Author

gallak87 commented Aug 28, 2021

For anyone who comes across this issue, I resolved it by adding a --root my_company_name CLI option to my protobuf generation steps. The issue was our proto package's Timestamp generated code was clobering fabric-protos generated protobuf code and we explicitly compile with --no-create causing the issue above.

This is because both our protos, and fab protos, were not setting the root flag, and thus both proto generated packages would use:

var $root = $protobuf.roots['default'] || ($protobuf.roots['default'] = {});

I suggest Fabric do the same and generate all their protos under their own root to prevent this clober

@davidkhala
Copy link
Member

I see similar clober issue once before but not recently. would you mind give a Pull Request for it?

@gallak87
Copy link
Author

@davidkhala I couldn't find your scripts for generating the protos. If you point me to the script I could make the PR.

@davidkhala
Copy link
Member

@davidkhala I couldn't find your scripts for generating the protos. If you point me to the script I could make the PR.

No, there was no need to have a script to get it fixed since it was fixed by maintainers once before. I am not quite sure if it is the same issue.
The second sentense is also not intended to include any scripts but welcome to contribute.

@bestbeforetoday
Copy link
Member

There are some npm scripts in fabric-protos/package.json that are used to regenerate the protobufs published in the fabric-protos package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants