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

couchup returns with unauthorized #1053

Closed
mado89 opened this issue Dec 7, 2017 · 8 comments
Closed

couchup returns with unauthorized #1053

mado89 opened this issue Dec 7, 2017 · 8 comments

Comments

@mado89
Copy link

@mado89 mado89 commented Dec 7, 2017

When trying to upgrade some datebases on a ubunt 14.04 machine couchup always returns with
{"error":"unauthorized","reason":"unauthorized to access or create database http://127.0.0.1:5986/acra-db/"}

before that there is an error:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "./couchup", line 92, in _watch_replication
raise Exception('Cannot retrieve {} doc_count!'.format(db))

Is there something I am missing?

@wohali
Copy link
Member

@wohali wohali commented Jan 16, 2018

Were you able to resolve this on your own?

Can you get us copies of the couch log files from these machines when this happens?

@marcinrozanski
Copy link

@marcinrozanski marcinrozanski commented Jan 18, 2018

I had the same problem, the following worked for me.

/opt/couchdb/bin/couchup replicate -a --login admin --password {ADMIN_PASSWORD}

I suggest looking at code of 'couchup' tool for more useful arguments.

@wohali
Copy link
Member

@wohali wohali commented Jan 18, 2018

Yes, if you don't specify the correct login and password arguments, couchup won't work.

@wohali wohali closed this Jan 18, 2018
@mado89
Copy link
Author

@mado89 mado89 commented Jan 28, 2018

Well that might have been the problem. I deleted the database as it was not important so there is no way to reproduce it now :(

@paulocoghi
Copy link

@paulocoghi paulocoghi commented Apr 2, 2018

couchup replicate -a --login admin --password {ADMIN_PASSWORD}

This needs to be mentioned in couchup documentation: http://docs.couchdb.org/en/latest/install/upgrading.html#couchup-utility

@wohali
Copy link
Member

@wohali wohali commented Apr 2, 2018

@paulocoghi pull requests on https://github.com/apache/couchdb-documentation are welcome!

@wohali wohali reopened this Apr 2, 2018
@wohali wohali closed this Apr 2, 2018
@SohamChakraborty
Copy link

@SohamChakraborty SohamChakraborty commented Jan 10, 2019

@wohali I am still getting same error. Same meaning without providing --login and --password it doesn't work, and the password may need to be presented in a different manner.

# /opt/couchdb/bin/couchup replicate -a --login admin --password whateverisadminpassword
Starting replication for configuration...
Traceback (most recent call last):
  File "/opt/couchdb/bin/couchup", line 508, in <module>
    main(sys.argv)
  File "/opt/couchdb/bin/couchup", line 502, in main
    args.func(args)
  File "/opt/couchdb/bin/couchup", line 223, in _replicate
    auth = 'Basic ' + base64.b64encode(':'.join(args['creds']))
  File "/usr/lib/python3.6/base64.py", line 58, in b64encode
    encoded = binascii.b2a_base64(s, newline=False)
TypeError: a bytes-like object is required, not 'str'
@pealthoff
Copy link
Contributor

@pealthoff pealthoff commented Jan 21, 2019

@wohali I am still getting same error. Same meaning without providing --login and --password it doesn't work, and the password may need to be presented in a different manner.

# /opt/couchdb/bin/couchup replicate -a --login admin --password whateverisadminpassword
Starting replication for configuration...
Traceback (most recent call last):
  File "/opt/couchdb/bin/couchup", line 508, in <module>
    main(sys.argv)
  File "/opt/couchdb/bin/couchup", line 502, in main
    args.func(args)
  File "/opt/couchdb/bin/couchup", line 223, in _replicate
    auth = 'Basic ' + base64.b64encode(':'.join(args['creds']))
  File "/usr/lib/python3.6/base64.py", line 58, in b64encode
    encoded = binascii.b2a_base64(s, newline=False)
TypeError: a bytes-like object is required, not 'str'

@SohamChakraborty

I was having the same problem, and correct this by using python2 to run the couchup.
To run you will have to correct an error on the couchup script, the alternative to python2 (inside the exept) must be:

from urllib import quote

wohali added a commit that referenced this issue Jan 21, 2019
janl added a commit that referenced this issue Feb 7, 2019
janl added a commit that referenced this issue Feb 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants