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

Error to connect kafka when I change version to v0.9.0 #67

Closed
rosicleiafrasson opened this issue May 17, 2022 · 6 comments
Closed

Error to connect kafka when I change version to v0.9.0 #67

rosicleiafrasson opened this issue May 17, 2022 · 6 comments
Labels
🐛 Bug Something isn't working

Comments

@rosicleiafrasson
Copy link

rosicleiafrasson commented May 17, 2022

My script worked in version v0.8.0. After I switch to version 0.9.0 I started getting this error:

Failed to write message: read tcp ip: read: connection reset by peerFailed to write message.

import { check } from "k6";
import {
    writer,
    produceWithConfiguration,
    createTopic,
} from "k6/x/kafka"; 
import http from 'k6/http';
import encoding from 'k6/encoding';

const bootstrapServers = ["xxx:9092"];
const topic = "payin";

const auth = JSON.stringify({
    username: "xxx",
    password: "xxx",
    algorithm: "SHA512",
});

const producer = writer(bootstrapServers, topic, auth);

var configuration = JSON.stringify({
    producer: {
        keySerializer: "io.confluent.kafka.serializers.KafkaAvroSerializer",
        valueSerializer: "io.confluent.kafka.serializers.KafkaAvroSerializer",
    },
    schemaRegistry: {
        url: "xxxx",
        basicAuth: {
            credentialsSource: "USER_INFO",
            userInfo: "xxx:xxx",
        },
    },
});

export default function () {

    const credentials = `xxx:xxx`;
    const encodedCredentials = encoding.b64encode(credentials);
    const options = {
        headers: {
        Authorization: `Basic ${encodedCredentials}`,
        },
    };

const result = http.get('xxxx', options)
const schema = JSON.parse(result.body).schema

let messages = [
    {
        value: JSON.stringify({
            "status": "PROPOSED"
        }),
    },
];

let error = produceWithConfiguration(
    producer,
    messages,
    configuration,
    null,
    schema
);

check(error, {
    "is sent": (err) => err == undefined,
});

}
@eabreusantos
Copy link

I'm having the same behavior.

@mostafa
Copy link
Owner

mostafa commented May 18, 2022

@rosicleiafrasson @eabreusantos
The APIs are slightly changed. Please check the scripts in the v0.9.0 tree. Also, I'm going to release a new version soon, which includes lots of changes.

@mostafa
Copy link
Owner

mostafa commented May 23, 2022

@rosicleiafrasson @eabreusantos
Any updates?

@rosicleiafrasson
Copy link
Author

Yes, I analyzed the way authentication in the v0.9.0 scripts. But the way is the same. I still have the same problem.

@mostafa
Copy link
Owner

mostafa commented Jun 16, 2022

@rosicleiafrasson @eabreusantos
Please update your scripts according to the latest changes to the API, as shown in this script and then build the latest main branch and test it to see if it works.

@mostafa mostafa moved this to Todo in xk6-kafka Jun 16, 2022
@mostafa mostafa added the 🐛 Bug Something isn't working label Jun 16, 2022
@mostafa mostafa moved this from Todo to Test in xk6-kafka Jun 16, 2022
@mostafa
Copy link
Owner

mostafa commented Jun 20, 2022

Released in v0.11.0.

@mostafa mostafa closed this as completed Jun 20, 2022
@mostafa mostafa moved this from Test to Release in xk6-kafka Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
Status: Release
Development

No branches or pull requests

3 participants