confluentinc / examples

Apache Kafka and Confluent Platform examples and demos
Apache License 2.0
1.91k stars 1.12k forks source link

ERROR: Could not validate credentials to Confluent Cloud Schema Registry. Please troubleshoot #1102

Open NeilBumford opened 2 years ago

NeilBumford commented 2 years ago

Hi,

I'm getting the above error when trying to run the spring boot example.

I believe I have the Schema Registry set up and I've generated a schema registry key.

Here's my java.config:

`bootstrap.servers=pkc-l6wr6.europe-west2.gcp.confluent.cloud:9092 security.protocol=SASL_SSL sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username='[REMOVED KEY]' password='[REMOVED VALUE]'; sasl.mechanism=PLAIN

client.dns.lookup=use_all_dns_ips

session.timeout.ms=45000

acks=all

schema.registry.url=https://psrc-kk5gg.europe-west3.gcp.confluent.cloud basic.auth.credentials.source=USER_INFO schema.registry.basic.auth.user.info=[REMOVED KEY]:[REMOVED VALUE]`

I guess I've missed something?

ybyzek commented 2 years ago

@NeilBumford can you validate the credentials with something like the following (substitute your values):

curl -u <SR API KEY>:<SR API SECRET> https://<SR ENDPOINT>/subjects
NeilBumford commented 2 years ago

Hi,

It came back with:

[]

I guess that's a fail, then?

ybyzek commented 2 years ago

[] should be a pass and indicates no subjects are defined.

A fail would have resulted in some kind of more obvious auth error, e.g.

{"error_code":401,"message":"Unauthorized"}                                                                                                                       
NeilBumford commented 2 years ago

OK, so am I missing something?

ybyzek commented 2 years ago

@NeilBumford if this is for Springboot, the input configuration file should be of the syntax shown here: https://github.com/confluentinc/examples/blob/7.1.0-post/clients/docs/includes/configs/cloud/springboot-sr.config

NeilBumford commented 2 years ago

OK. Are you referring to java.config when you say "input configuration file" or should I have a springboot-sr.config file somewhere? I'm not very experienced with spring boot.

ybyzek commented 2 years ago

Whatever the file is that is input to the application, and yes, in your case it looks like you've named it java.config

NeilBumford commented 2 years ago

Just following the docs :)

Hmmm. Same error.

NeilBumford commented 2 years ago

There's this line above the error text:

curl: no URL specified!

NeilBumford commented 2 years ago

Don't know if this is relevant but this property in java_producer_consumer.delta isn't being written to:

schema.registry.basic.auth.user.info