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

Confluent_Schema_Registry - User is denied operation WriteCompatibility on Subject: xxxx #246

Open
enzo-cappa opened this issue Jul 14, 2023 · 2 comments

Comments

@enzo-cappa
Copy link

Hello,

We recently started to use Roles in Confluent Cloud Schema Registry. We discovered that when we use a role (DeveloperWrite for all subjects) that can write schemas, but not change compatibility level, kafkajs will fail to register or produce with the error given above: Confluent_Schema_Registry - User is denied operation WriteCompatibility on Subject: xxxx. However, we don't set the compatibility level as a parameter. What we do is:

register(
      {
        type: SchemaType.AVRO,
        schema: data,
      },
      {
        subject, // string
      },
);

This should not be the case, as the the library should not set the compatiblity level unless is passed as a param. From what I see in

if (compatibility && isFirstTimeRegistration) {
, the compat level is always sent on registration, as it would either come as a param or from the defaults. Again, my understanding is that this shouldn't happen, as the default schema from the global Schema Registry configuration would be used, and that is what we want to enforce for our clients.

Full error:

ResponseError: Confluent_Schema_Registry - User is denied operation WriteCompatibility on Subject: raw.data.batched-issue-operation-value
    at /srv/app/node_modules/@kafkajs/confluent-schema-registry/dist/api/middleware/errorMiddleware.js:17:37
@rogen-code
Copy link

Workaround is set compatibility to null ...

But yes, agree

@silverwind
Copy link

silverwind commented Apr 30, 2024

Workaround is set compatibility to null ...

Yes, that works, but it does present a typescript error:

Type 'null' is not assignable to type 'COMPATIBILITY | undefined'

Setting compatibility: undefined fixed it for me.

The lib tries to set COMPATIBILITY.BACKWARD when the property is not present, while imho it has no business to do that unless the property is provided by the user.

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

No branches or pull requests

3 participants