We’re getting a 500 internal server error when trying to create a user via the API, here’s what I get from production.log:
Started POST "/users" for 127.0.0.1 at 2018-03-06 13:28:04 +0000
Processing by UsersController#create as */*
Parameters: {"email"=>"removed", "api_key"=>"[FILTERED]", "api_username"=>"removed", "username"=>"removed", "name"=>"removed", "password"=>"[FILTERED]"}
Rendering text template
Rendered text template (0.0ms)
Completed 500 Internal Server Error in 42ms (Views: 1.7ms | ActiveRecord: 9.6ms)
I’m just using curl on the machine itself, so via:
curl -k -v -X POST -F 'email=removed' -F 'api_key=removed' -F 'api_username=removed' -F 'username=removed' -F 'name=removed' -F 'password=removed' https://foo.bar/users
Worth noting that getting the list of users via the API works just fine. Same api_key and api_username.
New user registration is enabled, and invite only is enabled.
We’re using the LDAP plugin, but I can’t see what that’d have to do with the API.
Our version’s at v2.0.0.beta3 +292
, which might also be a problem, since this stopped working after an upgrade.
Doing a rebuild app doesn’t fix the issue.
If needed, I can provide the verbose curl out as well, but the only important bit there is:
< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
< Server: nginx
< Date: Tue, 06 Mar 2018 13:52:25 GMT
< Content-Type: text/plain; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Discourse-Username: removed
< X-Discourse-Route: users/create
< Cache-Control: no-store, must-revalidate, no-cache, private
< X-Request-Id: d8dfb524-26b7-4a76-a4a8-96f70cb9e244
< Set-Cookie: __profilin=p%3Dt%2Ca%3D5b595ba25bbff59a6b51f6d39f6ace45%7C0b364c7fb766ced5be17866e10020175; path=/
< X-Runtime: 0.027306
* HTTP error before end of send, stop sending
We’ve also got some older backups, so restoring to a previous version can be done. We’ve not gone live with this yet, so we can break it (further) to some extent.
Cheers,
Juraj