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

Failed to get TLS config. Continuing without TLS." error="No TLS config provided. ,cannot create a kafka writer with a nil address #84

Closed
kusumkappdirect opened this issue Jun 8, 2022 · 4 comments
Labels
2️⃣ Duplicate This issue or pull request already exists 🐛 Bug Something isn't working

Comments

@kusumkappdirect
Copy link

kusumkappdirect commented Jun 8, 2022

My configuration fille is :
export var configuration = JSON.stringify({
"producer": {
"keySerializer": "org.apache.kafka.common.serialization.StringSerializer",
"valueSerializer": "io.confluent.kafka.serializers.KafkaAvroSerializer",
},
"schemaRegistry": {
"url": __ENV.KAFKA_CONFLUENT_SCHEMA_REGISTRY_URL
},
});

Script file is::
import { check } from "k6";
import {
writer,
produceWithConfiguration,
createTopic
} from "k6/x/kafka";

import {configuration} from "./configuration.js"

const bootstrapServers = [__ENV.KAFKA_BOOTSTRAP_SERVERS];
const topic = "quotes-test.itg-load.default";

const username = __ENV.KAFKA_USERNAME;
const password = __ENV.KAFKA_PASSWORD;
const protocol = __ENV.KAFKA_SECURITY_PROTOCOL;
console.log("protocol is :"+protocol);

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

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

const valueSchema = { "type": "record", "namespace": "com.appdirect.prm.quotes.event", "name": "QuoteStatusChanged", "fields": [ { "name": "previousStatus", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "eventMetadata", "type": { "fields": [ { "name": "id", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "timestamp", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "type", "type": { "avro.java.string": "String", "type": "string" } }, { "default": null, "name": "operation", "type": [ "null", { "avro.java.string": "String", "type": "string" } ] } ], "name": "EventMetadata", "namespace": "com.appdirect.common.event", "type": "record" } }, { "name": "quote", "type": { "fields": [ { "name": "id", "type": { "avro.java.string": "String", "type": "string" } }, { "default": null, "name": "name", "type": [ "null", { "avro.java.string": "String", "type": "string" } ] }, { "name": "createdOn", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "tenant", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "ownerUser", "type": { "fields": [ { "name": "id", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "company", "type": { "fields": [ { "name": "name", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "id", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "isReseller", "type": "boolean" } ], "name": "Company", "type": "record" } }, { "name": "email", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "firstName", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "lastName", "type": { "avro.java.string": "String", "type": "string" } } ], "name": "User", "type": "record" } }, { "name": "source", "type": { "fields": [ { "name": "id", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "sourceType", "type": { "avro.java.string": "String", "type": "string" } } ], "name": "Source", "type": "record" } }, { "name": "customerUser", "type": "User" }, { "name": "createdBy", "type": "User" }, { "name": "status", "type": { "avro.java.string": "String", "type": "string" } }, { "name": "displayId", "type": { "avro.java.string": "String", "type": "string" } } ], "name": "Quote", "type": "record" } } ] };

export default function () {
console.log("BootServer connected"+bootstrapServers);
const schemaConfig=__ENV.KAFKA_CONFLUENT_SCHEMA_REGISTRY_URL;
console.log("schema connected"+schemaConfig);

    let messages = [
        {
            key: "546e3fa1-3c42-46f5-8a39-be3d0a01450",
            value: JSON.stringify({
                "eventMetadata": {
                    "id": "365ea153-5011-4692-b677-d4e667013488",
                    "timestamp": "2022-04-22T05:44:56+00:00",
                    "type": "QuoteStatusChanged",
                    "operation": null
                },
                "quote":{
                    "id": "c4cfcd3c-090f-4770-91eb-aed66daf5d08",
                    "name":null,
                    "createdOn": "2022-04-22T05:44:51.762Z",
                    "tenant": "ITGDI",
                    "ownerUser":{
                        "id":"kusum",
                        "company": {
                            "id":"123",
                            "name": "1630556e-3e55-4ac9-8078-956ea525fcbc",
                            "isReseller":true
                        },
                        "email": "kusum.khandelwal+itgdi@appdirect.com",
                        "firstName": "MM",
                        "lastName": "NAME CHANGE"
                    },
                    "customerUser": {
                        "id": "9df5537f-148d-4f55-a57f-6572d3d90832",
                        "company": {
                            "id": "ecfd1e97-6785-4096-850a-6977e733817e",
                            "name": "ABC Enterprises",
                            "isReseller": false
                        },
                        "email": "kusum.khandelwal+c2@appdirect.com",
                        "firstName": "Company",
                        "lastName": "1"
                    },
                    "createdBy": {
                        "id": "80d36759-ba84-46d5-a7f2-4fa9740b1585",
                        "company": {
                            "id": "1630556e-3e55-4ac9-8078-956ea525fcbc",
                            "name": "AppDirect",
                            "isReseller": false
                        },
                        "email": "kusum.khandelwal+itgdi@appdirect.com",
                        "firstName": "MM",
                        "lastName": "NAME CHANGE"
                    },

                    "source": {
                        "id": "3eb68099-f05e-4040-86e5-842c3168f105",
                        "sourceType": "OPPORTUNITY"
                    },
                    "status": "PENDING",

                    "displayId": "Q6000678"
                },

                "previousStatus": "OPEN"
            })
        }];
    let error = produceWithConfiguration(
        producer,
        messages,
        configuration,
        null,
        valueSchema
    );
    check(error, {
        "is sent": (err) => err == undefined,
    });

}
export function teardown( data ) {
producer.close();
}

@kusumkappdirect kusumkappdirect changed the title Can any one help ,i am getting time="2022-06-07T07:50:34Z" level=warning msg="Failed to get TLS config. Continuing without TLS." error="No TLS config provided." 14 time="2022-06-07T07:50:34Z" level=error msg="kafka.(*Writer).WriteMessages: cannot create a kafka writer with a nil address" error="kafka.(*Writer).WriteMessages: cannot create a kafka writer with a nil address" , how to config ssl in xk6-kafka. Failed to get TLS config. Continuing without TLS." error="No TLS config provided. ,cannot create a kafka writer with a nil address Jun 8, 2022
@mostafa
Copy link
Owner

mostafa commented Jun 8, 2022

@kusumkappdirect
Can you please update the issue and include relevant information and elaborate?

I suppose this is a duplicate of:

@kusumkappdirect
Copy link
Author

@mostafa , I am trying to send the kafka-event , for that i created topic, create a producer, while sending i am getting this error,

time="2022-06-07T07:50:34Z" level=warning msg="Failed to get TLS config. Continuing without TLS." error="No TLS config provided."

14
time="2022-06-07T07:50:34Z" level=error msg="kafka.(*Writer).WriteMessages: cannot create a kafka writer with a nil address" error="kafka.(*Writer).WriteMessages: cannot create a kafka writer with a nil address"

i need to add these security Not sure how to add

Security configuration
Confluent Kafka Clusters
SASL_SSL/PLAIN is the security model used for Confluent Kafka cluster.

Set the following properties to configure this security model in your client

security.protocol
Value: SASL_SSL

sasl.mechanism
Value: PLAIN

sasl.jaas.config
Value: org.apache.kafka.common.security.plain.PlainLoginModule required username="{{ KAFKA_USERNAME }}" password="{{ KAFKA_PASSWORD }}";

@mostafa
Copy link
Owner

mostafa commented Jun 8, 2022

@kusumkappdirect This is a bug, as I mentioned in #56.

@mostafa mostafa added 🐛 Bug Something isn't working 2️⃣ Duplicate This issue or pull request already exists labels Jun 12, 2022
mostafa added a commit that referenced this issue Jun 13, 2022
* Fix SASL and TLS issues reported in #56 and #84
* Replace dead status code
* Fix error message
* Exclude gosec G402 error
* Update JS API docs
* Add API docs with typedoc (#87)
@mostafa mostafa moved this to Test in xk6-kafka Jun 13, 2022
@mostafa
Copy link
Owner

mostafa commented Jun 13, 2022

I'll close this, as it is fixed in #86. Let's continue the discussion on #56.

@mostafa mostafa closed this as completed Jun 13, 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
2️⃣ Duplicate This issue or pull request already exists 🐛 Bug Something isn't working
Projects
Status: Release
Development

No branches or pull requests

2 participants