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

Getting 500 error code while trying to fetch id with invalid credentials #2419

Closed
rkpattnaik780 opened this issue Apr 8, 2022 · 1 comment · Fixed by #2497
Closed

Getting 500 error code while trying to fetch id with invalid credentials #2419

rkpattnaik780 opened this issue Apr 8, 2022 · 1 comment · Fixed by #2497
Assignees
Labels

Comments

@rkpattnaik780
Copy link

Trying to fetch schema id with invalid credentials using the library @kafkajs/confluent-schema-registry throws 500 error.

Environment: production

const { SchemaRegistry } = require('@kafkajs/confluent-schema-registry');

const registry = new SchemaRegistry({
  host: process.env.REGISTRY_URL,
  auth: {
    username: "admin",
    password: "admin",
  }
});

const id = await registry.getLatestSchemaId(process.env.TOPIC);

Response:

ResponseError: Confluent_Schema_Registry - Error, status 500: <!doctype html>
....
</html>
    at /home/rkpattnaik780/coding/github_repos/rhoas-node-poc-blog/node_modules/@kafkajs/confluent-schema-registry/dist/api/middleware/errorMiddleware.js:17:37
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  status: 500,
  unauthorized: false,
  url: 'get https://bu98.serviceregistry.rhcloud.com/t/cc8a243a-feed-4a4c-9394-5a35ce83cca5/apis/ccompat/v6/subjects/tweets-topic/versions/latest'

Providing valid credentials without permissions or omitting auth object give expected response. (403 and 401). Should this particular case be made to return 401?

@carlesarnal
Copy link
Member

Thanks for raising this.

I have confirmed it and yes, this is happening when a non-existing client is being passed to the application. The attached pr fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants