Using protobuf with k6

is there a way to implement google-protobuffer in my script.js?
There is a proto.js file and google-protobuf.js (which is required by proto.js), when I import proto.js it raised an error said that “ReferenceError: goog is not defined”.
the google-protobuf.js should be imported in a “wildcard” way or may be other tricks?
I am not sure,hope anyone could give me some suggestions. Thanks!


I haven’t tried to use protobufs or used any implementation of them with k6 and I don’t know of anyone who has, successfully or otherwise :frowning: . In general if you are using some node library you will need to read the doc on using node libraries with k6 and be aware that maybe k6 doesn’t support one or more feature of js that will be used.

In the case of protobufs this probably isn’t the case and you should be able to use the lib after running it through browsefy if required.

Can you provide more step by step explanation to what you are doing and maybe a sample k6 script. I suppose you can make a github repo for that purpose or upload an archive somewhere?

Thank you for replying.

I think I had just figured out how to do it within the process of making a “step by step explanation”,so I just created a repo on GitHub, here is the link Demo,basically follow the doc , along with some modifications on the proto.js file.

That’s it. I am not familiar javascript stuffs, so this takes me more time than I expected.
Anyway, hope this topic could be helpful.