xk6-kafka: Error serializing value data when using type array using Avro schema
Hello,
I’m running some Kafka load test using xk6-kafka and i’m getting some errors when serializing objects. In my Avro schema there is some fields that are array type and seems that when calling schemaRegistry.serialize() i’m getting the following error:
k6-1 | time="2024-01-09T06:55:21Z" level=error msg="panic: runtime error: invalid memory address or nil pointer dereference\ngoroutine 59 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x5e\ngo.k6.io/k6/js/common.RunWithPanicCatching.func1()\n\tgo.k6.io/k6@v0.48.0/js/common/util.go:82 +0x1df\npanic({0x17c3520?, 0x2d13300?})\n\truntime/panic.go:914 +0x21f\ngithub.com/dop251/goja.(*Runtime).runWrapped.func1()\n\tgithub.com/dop251/goja@v0.0.0-20231027120936-b396bb4c349d/runtime.go:2442 +0x171\npanic({0x17c3520?, 0x2d13300?})\n\truntime/panic.go:914 +0x21f\ngithub.com/dop251/goja.(*vm).handleThrow(0xc002b547e0, {0x17c3520, 0x2d13300})\n\tgithub.com/dop251/goja@v0.0.0-20231027120936-b396bb4c349d/vm.go:788 +0x425\ngithub.com/dop251/goja.(*vm).try.func1()\n\tgithub.com/dop251/goja@v0.0.0-20231027120936-b396bb4c349d/vm.go:807 +0x3f\npanic({0x17c3520?, 0x2d13300?})\n\truntime/panic.go:914 +0x21f\ngithub.com/dop251/goja.(*vm).handleThrow(0xc002b547e0, {0x17c3520, 0x2d13300})\n\tgithub.com/dop251/goja@v0.0.0-20231027120936-b396bb4c349d/vm.go:788 +0x425\ngithub.com/dop251/goja.(*vm).runTryInner.func1()\n\tgithub.com/dop251/goja@v0.0.0-20231027120936
I tried with another Avro schema without that type array and it worked. Is there a way to pass that data to the serialice method? Thanks in advance.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (8 by maintainers)
Hello @mostafa
it worked! Thanks for your help 😃
@ricardpons @ferrange @irenedmg
Found the issue! You have to use the type with its namespace to provide meaningful data to the Avro codec. So, instead of using the bare
"EmailAddressBasicInfo", use"internalservices.itoperation.emailmessage.EmailAddressBasicInfo"instead. The following collapsibles include a working schema and a JSON data object:Schema
Data
I created this repo to test your schema and data.
Hi @mostafa sure, here is an example of the message we produce working, which has commented the fragment I think it should work but it doesn’t. You will see the same property “emailAddressReplyTo” as null, which works fine:
@mostafa here you have the full schema which works fine when we send the message like this
{"emailAddressReplyTo": null}:The problem comes when we try to use the emailAddressReplyTo != null, as @irenedmg showed above
Thanks in advance!