shred/acme4j

Unable to update account message

adamtg opened this issue · 6 comments

All of the sudden, i started getting this error:

org.shredzone.acme4j.exception.AcmeServerException: Unable to update account :: too many/too long contact(s). Please use shorter or fewer email addresses

But using the same email and domain name, i am able to get a certificate using certbot. I haven't changed the code in months, and this is the first time i have seen this error.

thank you

shred commented

The error is reported by the server, so it really seems that there are either too many or too long contacts.

You can read the list of contacts by getting an Account object of your account, and then invoking getContacts() and check the result. I guess that you have a large number of identical addresses. 😄 If so, you can modify the contact list like described here to remove all unused or duplicate addresses.

The next step would be to find out where the duplicate addresses come from.

Why would the same exact email address and domain work with certbot, and not with the code using acme4j?

shred commented

I can only guess from the few information you have given me so far.

acme4j just passes your email addresses to the server, but does not apply any constrains on it. The server limits the entire contact JSON structure to a size of 191 bytes. The error occurs if that limit is exceeded on the server. It is the same behavior for acme4j and certbot.

According to the error message, you are trying to modify your account via acme4j. Before you invoke commit(), can you invoke getContacts() and check if the result is as expected?

Account.EditableAccount edit = account.modify();

// Now you do all your usual account modifications...

System.out.println(edit.getContacts());
edit.commit();  // your commit that throws the exception

If the list of contacts looks unsuspicious, you can also enable the debug log level. acme4j will then log the JSON structure that is sent to the server and triggers the error. You can enable debug log e.g. with passing -Dorg.slf4j.simpleLogger.log.org.shredzone.acme4j=debug as Java parameter, unless you use another slf4j log target.

Please understand that it is hard for me to help you if I don't know your source code, or the problematic email address.

Thank you very much for the diagnostic help. I will add them in and see what is going on.

The debugging showed exactly what was happening, and it was definitely my mistake. Every time i requested a certificate, i was calling:

Account.EditableAccount edit = account.modify();
edit.addEmail(email).commit(); 

and the email list would keep on growing. All i do now is clear the list before it is called, and everything works as expected.

Thank you very much for your time and help.

shred commented

This was what I was suspecting. 😃 I'm glad you could fix it.