phpdocker-io/kong-certbot-agent

Error code 400 on cert update

Closed this issue · 6 comments

Kong docker image: 0.14.1
kong-certbot-agent image: 2.0.2

When running manually or via cron, I'm getting the following error:

In RequestException.php line 113:
                                                                               
  Client error: `POST http://kong:8001/certificates` resulted in a `400 Bad R  
  equest` response:                                                            
  {"strategy":"postgres","message":"schema violation (snis: ****** already associated with existing certi (truncated...)                 
                                                                               

certs:update [-t|--test-cert] [--] <kong-endpoint> <email> <domains>

I don't know if this is a change in Kong, but this was also cited in #10 for a different reason. I think the fix is to also check for 400 at https://github.com/luispabon/kong-certbot-agent/blob/master/Command/UpdateCertificatesCommand.php#L114 since this seems to be the actual behavior when trying to update an existing snis.

I suck at github.

lol

@RandallBurt could you please deploy tag 2.2.0-beta1 and test?

Kong docker image: kong:alpine [2.0.0; latest]
kong-certbot-agent image: kong-certbot-agent:latest [3.2.2]

Using the latest versions of the dockers, the agent can't put new certs on Kong.
Return this error:

replaced the domain with <domain_name>; it's just one registry

Kong error: code 400, message Kong error 400: Client error: `PUT http://kong:8001/certificates/<domain_name>` resulted in a `400 Bad Request` response:
{"message":"schema violation (snis: <domain_name> is duplicated)","name":"schema violation","fields":{" (truncated...)
. Request method `PUT`, headers {"User-Agent":["GuzzleHttp\/6.5.1 curl\/7.58.0 PHP\/7.4.1"],"Content-Type":["application\/json"],"Host":["kong:8001"],"accept":["application\/json"]}, body "", domains <domain_name>

The validation passed without problems. And both containers are built thought docker-compose.

Thank you, looks like the interface has changed in Kong 2.0.