You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it gives below error
ERRO[0015] GoError: Failed to unmarshal JSON data, OriginalError: %!w(*json.SyntaxError=&{invalid character 'd' after top-level value 3})
running at github.com/mostafa/xk6-kafka.(*Kafka).schemaRegistryClientClass.func5 (native)
default at file:////dev-test.js:134:68(135) executor=shared-iterations scenario=default source=stacktrace
Below is the full script
import {
LoadJKS,
TLS_1_2
} from "k6/x/kafka";
import {
Writer,
Reader,
Connection,
SchemaRegistry,
SCHEMA_TYPE_JSON,
SASL_SCRAM_SHA512
} from "k6/x/kafka";
import VaultManager from './VaultManager.js';
export let options = {
stages: [{
target: 1,
duration: '30s'
}
],
};
export const vault = new VaultManager('Dev', 'DEV');
let offset = -1;
// partition and groupId are mutually exclusive
let partition = 0;
let numPartitions = 1;
let replicationFactor = 1;
let username = "";
let password = "";
let passwordToAccessTrustore = "";
let saslConfig = {};
let writer;
let reader;
let connection;
export function setup() {
console.log('Inside setup function ');
username = vault.getSecretFromVault("USERNAME");
password = vault.getSecretFromVault("PASSWORD");
}
export function initializeCredentials() {
console.log('Inside initializeCredentials function');
if (!username || !password) {
username = vault.getSecretFromVault("USERNAME");
password = vault.getSecretFromVault("PASSWORD");
passwordToAccessTrustore = vault.getSecretFromVault("AZURE-IPACE-PASSWORD-JKS");
saslConfig = {
username: username,
password: password,
algorithm: SASL_SCRAM_SHA512
};
console.log('saslConfig = ' + saslConfig);
}
}
const clientCertPem = vault.getIPaceEnvConfig().getValueFromEnvFor('ROOTDIR')+'/client-cert-0.pem';
const clientKeyPem = vault.getIPaceEnvConfig().getValueFromEnvFor('ROOTDIR')+'/client-key.pem';
const serverCaPem = vault.getIPaceEnvConfig().getValueFromEnvFor('ROOTDIR')+'/server-ca.pem';
export default function(data) {
initializeCredentials();
const tlsConfig = {
enableTls: true,
insecureSkipTlsVerify: true,
minVersion: TLS_1_2,
clientCertPem: clientCertPem, // The first certificate in the chain
clientKeyPem: clientKeyPem,
serverCaPem: serverCaPem,
};
const brokers = ["digital.net:443"];
const topic = "internal.any.v1";
const schemaRegistry = new SchemaRegistry();
writer = new Writer({
brokers: brokers,
topic: topic,
sasl: saslConfig,
partition: partition,
tls: tlsConfig,
});
reader = new Reader({
brokers: brokers,
topic: topic,
partition: partition,
offset: offset,
sasl: saslConfig,
tls: tlsConfig,
});
connection = new Connection({
address: brokers[0],
sasl: saslConfig,
tls: tlsConfig,
});
let messages = [{
key: schemaRegistry.serialize({
data: {
correlationId: "test-id-abc-" + 1,
},
schemaType: SCHEMA_TYPE_JSON,
}),
value: schemaRegistry.serialize({
data: {
templateId: 5,
testId: 4,
status: "deactive",
message: "Hi, I am testing",
},
schemaType: SCHEMA_TYPE_JSON,
}),
}];
writer.produce({
messages: messages,
});
messages = reader.consume({ limit: 10 });
console.log("correlation------>>>>>", schemaRegistry.deserialize({
data: messages[0].key,
schemaType: SCHEMA_TYPE_JSON,
}));
console.log("schema------>>>>>", schemaRegistry.deserialize({
data: messages[0].value,
schemaType: SCHEMA_TYPE_JSON,
}));
}
export function teardown() {
if (writer) writer.close();
if (reader) reader.close();
if (connection) connection.close();
}
The text was updated successfully, but these errors were encountered:
mostafa
changed the title
ERRO[0015] GoError: Failed to unmarshal JSON data, OriginalError: %!w(*json.SyntaxError=&{invalid character 'd' after top-level value 3}) running at github.com/mostafa/xk6-kafka.(*Kafka).schemaRegistryClientClass.func5 (native)
/invalid character 'd' after top-level value 3
Jul 18, 2023
@mostafa
Below is my script, while logging the
running at github.com/mostafa/xk6-kafka.(*Kafka).schemaRegistryClientClass.func5 (native)
default at file:////dev-test.js:134:68(135) executor=shared-iterations scenario=default source=stacktrace
Below is the full script
The text was updated successfully, but these errors were encountered: