401/500 error on creating Sync Gateway user

While trying to re-format some of my code, I started running into the following problem, and am unable to create new users… Has anyone run into this?

curl -vX PUT -H "Content-Type: application/json" --data '{"password":"SomePassword"}' http://localhost:4985/db/_user/myusername

* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 4985 (#0)
> PUT /db/_user/myusername HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:4985
> Accept: */*
> Content-Type: application/json
> Content-Length: 27
> 
* upload completely sent off: 27 out of 27 bytes
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json
* Server Couchbase Sync Gateway/1.1.0 is not blacklisted
< Server: Couchbase Sync Gateway/1.1.0
< Date: Fri, 18 Sep 2015 03:04:13 GMT
< Content-Length: 275
< 
* Connection #0 to host localhost left intact
{"error":"Internal Server Error","reason":"Internal error: error executing view req at http://127.0.0.1:8092/app-data/_design/sync_gateway/_view/access?key=%22myusername%22\u0026stale=false: 401 Unauthorized - {\"error\":\"unauthorized\",\"reason\":\"password required\"}\n"}

I’ve never encountered this error before. Can you paste the logs from Sync Gateway?

Thanks
James

Hey @jamiltz, it looked like my Couchbase Server suddenly got a password attached to it (even though, as far as I know, no one added one) - I removed that, and it worked.

Now, I’m running into 401 errors using Couchbase Lite - this all seemed to spring up after Sync Gateway 1.1

Have you tried using curl to test the session endpoint with a username/password that exists?

Hey, it ended up working - but I’m not sure what I did.

I basically tried rebooting everything, restarting everything, etc… And it just started to work. That tends to be the solution to my CB and SG problems, but I wish it was a bit more deterministic.

1 Like