Error when altering schema with secret directive


Report a Dgraph Bug

What version of Dgraph are you using?

v20.07.0

Steps to reproduce the issue (command/config used to run Dgraph).

When you try to alter a schema having secret directive, it throws an error.

For eg. if you have a schema like this:

type MySchema @secret(field: "password") {
}

and you try to alter the secret field to something like this:

type MySchema @secret(field: "mynewpassword") {
}

You get this error:

Also, an unrelated question, if I update my schema when the database already has data, are there chances on the nodes becoming orphan at any point of time?

Hey @tvvignesh, thanks for reporting the issue. We have acknowledged it.

Also, an unrelated question, if I update my schema when the database already has data, are there chances on the nodes becoming orphan at any point of time?

Yeah, when we do update Schema, it doesn’t have any effect on the underlying data. So data will be present there in the database even if the corresponding field/type is dropped from the schema.

1 Like

Hi @tvvignesh, I am not able to reproduce this error as you mentioned instead I tried below and got this error which is a valid error.

 type MySchema @secret(field:pwd) {
   mynewpassword:String
}

 type MySchema @secret(field:mynewpassword) {
  name:String
}

I suppose you had field name mynewpassword as a string type and you tried to put it in @secret(field:mynewpassword) which changes it to the password field and that is not allowed.
Please let me know if you tried something else and try to give some other name instead of mynewpassword and see if that works.

@JatinDevDG Oops. Sorry for that. You may be right. I am not able to reproduce it myself now. Yes, I was trying to switch back and forth to string and password and that might have caused this issue.

Just altering the secret is working now without any issues. Sorry for the trouble. You can close this. I will reply back again in this thread if I face it.