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

[SNI] Error on create the SNI by both PUT and POST requests #3168

Closed
jvahldick opened this issue Jan 22, 2018 · 4 comments
Closed

[SNI] Error on create the SNI by both PUT and POST requests #3168

jvahldick opened this issue Jan 22, 2018 · 4 comments
Labels
good first issue Issues that beginners/volunteers can easily help with.

Comments

@jvahldick
Copy link

Summary

I had two problems specifically with the /SNIS/ endpoint:

  • error 500 for POST request when the UUID format is invalid
  • "created_at is required" when I try to create a new certificate using the PUT request

When I try to create a new SNI certificate by a post request, I got the following message:

$http POST :8001/snis/ name="endpoint.com" ssl_certificate_id="some-invalid-uuid-format"

HTTP/1.1 500 Internal Server Error
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Mon, 22 Jan 2018 11:33:02 GMT
Server: kong/0.12.1
Transfer-Encoding: chunked

{
    "message": "An unexpected error occurred"
}

If I try to create the SNI by a PUT request, it is always requiring the created_at field.

$http PUT :8001/snis/ name="endpoint.com" ssl_certificate_id="4ee6de3e-fd1f-4ce1-9fed-86424378cc93"

HTTP/1.1 400 Bad Request
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Mon, 22 Jan 2018 11:44:10 GMT
Server: kong/0.12.1
Transfer-Encoding: chunked

{
    "created_at": "created_at is required"
}

Steps To Reproduce

  1. http POST :8001/snis/ name="endpoint.com" ssl_certificate_id="invalid-uuid-format" (The SSL Certification ID doesn't exist and the UUID format is invalid)
  2. PUT :8001/snis/ name="endpoint.com" ssl_certificate_id="98bc6baa-0490-486f-95ff-372a4a512127b" (I tried with a valid and invalid ssl_certificate_id)

Additional Details & Logs

I am running the kong using Docker 17.12.0-ce.
From the logs on docker side, I got this message in the POST request:

kong-database_1   | ERROR:  invalid input syntax for uuid: "some-invalid-uuid" at character 84
kong-database_1   | STATEMENT:  INSERT INTO ssl_servers_names("name", "ssl_certificate_id") VALUES('endpoint.com', 'some-invalid-uuid') RETURNING *

There is nothing reported in the error.log file for both cases.
Kong version: 0.11.2 and 0.12.1

I've checked #2800 and #2989, but couldn't find the answer for this.

@kikito kikito added the task/needs-investigation Requires investigation and reproduction before classifying it as a bug or not. label Jan 22, 2018
@Tieske
Copy link
Member

Tieske commented Jan 23, 2018

related #3148

@kikito
Copy link
Member

kikito commented Jan 24, 2018

Hello @jvahldick ,

The problem you are experiencing seems to be fixed by commit #3148, which is in the master branch but not on a release yet. ¿Could you please try the change in kong/api/routes/certificates.lua and see if it solves your issue? Remember to invoke kong reload after changing the file.

@kikito kikito added pending author feedback Waiting for the issue author to get back to a maintainer with findings, more details, etc... and removed task/needs-investigation Requires investigation and reproduction before classifying it as a bug or not. labels Jan 24, 2018
@jvahldick
Copy link
Author

jvahldick commented Apr 5, 2018

I updated the Kong version to 0.13, I tried to run the same commands and both problems remain. Also, replaced the certificates.lua file to the latest version reloading the kong, but the behavior still the same.

Log:
2018/04/05 14:37:58 [error] 112#0: *146924 [lua] responses.lua:121: handler(): ERROR: invalid input syntax for uuid: "some-invalid-uuid-format" (84), client: 192.168.65.3, server: kong_admin, request: "POST /snis/ HTTP/1.1", host: "localhost:8001"

@thibaultcha thibaultcha added good first issue Issues that beginners/volunteers can easily help with. and removed pending author feedback Waiting for the issue author to get back to a maintainer with findings, more details, etc... labels Apr 10, 2018
@thibaultcha
Copy link
Member

This issue is most likely gone from Kong 0.14, which moved the Certificate and SNI entities to the new DAO and the new auto-generated Admin API endpoints. Closing it and considering it resolved in 0.14. Feel free to reopen if a similar issue arises in a more recent version, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues that beginners/volunteers can easily help with.
Projects
None yet
Development

No branches or pull requests

4 participants