apache / openwhisk

Apache OpenWhisk is an open source serverless cloud platform
https://openwhisk.apache.org/
Apache License 2.0
6.54k stars 1.17k forks source link

error: The supplied authentication is invalid - Build failed when building in Ubuntu 14.04 #337

Closed eljuanchosf closed 8 years ago

eljuanchosf commented 8 years ago

Running the buid on a Ubuntu 14.04 Vagrant image I have this issue, which is consitent every time I do ant build run deploy.

installCatalog:
     [exec] Installing open catalog
     [exec] Installing package installSystem.sh with pid 25197
     [exec] Installing package installGit.sh with pid 25198
     [exec] Installing package installSlack.sh with pid 25199
     [exec] Installing package installWatson.sh with pid 25200
     [exec] Installing package installWeather.sh with pid 25201
     [exec] Installing whisk.system entities.
     [exec] Creating package system with pid 25245
     [exec] Creating package util with pid 25248
     [exec] Installing Slack package.
     [exec] Creating package samples with pid 25249
     [exec] Installing Git package.
     [exec] Creating package slack with pid 25250
     [exec] Creating package github with pid 25251
     [exec] Installing Weather package.
     [exec] Creating package weather with pid 25252
     [exec] Installing Watson package.
     [exec] Creating package watson with pid 25253
     [exec] error: The supplied authentication is invalid (code 7)
     [exec] error: The supplied authentication is invalid (code 4)
     [exec] error: The supplied authentication is invalid (code 9)
     [exec] 25251 finished with status 145
     [exec] Installing github/webhook with pid 25288
     [exec] 25245 finished with status 145
     [exec] error: The supplied authentication is invalid (code 3)
     [exec] error: The supplied authentication is invalid (code 8)
     [exec] error: The supplied authentication is invalid (code 6)
     [exec] error: The supplied authentication is invalid (code 5)
     [exec] 25248 finished with status 145
     [exec] 25249 finished with status 145
     [exec] Installing system/pipe with pid 25289
     [exec] 25252 finished with status 145
     [exec] 25250 finished with status 145
     [exec] Installing util/cat with pid 25290
     [exec] Installing util/sort with pid 25291
     [exec] Installing weather/forecast with pid 25292
     [exec] Installing slack/post with pid 25293
     [exec] Installing util/head with pid 25295
     [exec] Installing weather/pollen with pid 25294
     [exec] Installing util/date with pid 25296
     [exec] Installing samples/helloWorld with pid 25297
     [exec] Installing samples/greeting with pid 25298
     [exec] Installing samples/wordCount with pid 25299
     [exec] Installing samples/echo with pid 25300
     [exec] 25253 finished with status 145
     [exec] Installing watson/translate with pid 25301
     [exec] Installing watson/languageId with pid 25302
     [exec] error: The supplied authentication is invalid (code 10)
     [exec] error: The supplied authentication is invalid (code 11)
     [exec] 25301 finished with status 145
     [exec] error: The supplied authentication is invalid (code 12)
     [exec] 25289 finished with status 145
     [exec] error: The supplied authentication is invalid (code 13)
     [exec] 25302 finished with status 145
     [exec] Watson package ERRORS = 3
     [exec] error: The supplied authentication is invalid (code 15)
     [exec] error: The supplied authentication is invalid (code 14)
     [exec] 25288 finished with status 145
     [exec] Git package ERRORS = 2
     [exec] error: The supplied authentication is invalid (code 18)
     [exec] error: The supplied authentication is invalid (code 16)
     [exec] error: The supplied authentication is invalid (code 17)
     [exec] error: The supplied authentication is invalid (code 19)
     [exec] error: The supplied authentication is invalid (code 20)
     [exec] 25290 finished with status 145
     [exec] 25291 finished with status 145
     [exec] error: The supplied authentication is invalid (code 21)
     [exec] error: The supplied authentication is invalid (code 22)
     [exec] 25292 finished with status 145
     [exec] 25294 finished with status 145
     [exec] Weather package ERRORS = 3
     [exec] error: The supplied authentication is invalid (code 24)
     [exec] 25295 finished with status 145
     [exec] 25296 finished with status 145
     [exec] 25297 finished with status 145
     [exec] error: The supplied authentication is invalid (code 23)
     [exec] 25293 finished with status 145
     [exec] Slack package ERRORS = 2
     [exec] 25298 finished with status 145
     [exec] 25299 finished with status 145
     [exec] 25300 finished with status 145
     [exec] whisk.system entities ERRORS = 12
     [exec] 25197 finished with status 12
     [exec] 25198 finished with status 2
     [exec] 25199 finished with status 2
     [exec] 25200 finished with status 3
     [exec] 25201 finished with status 3
     [exec] open catalog ERRORS = 5

BUILD FAILED
/root/openwhisk/build.xml:56: The following error occurred while executing this line:
/root/openwhisk/build.xml:100: exec returned: 5

Total time: 41 minutes 47 seconds
rabbah commented 8 years ago

This error usually suggests that your backing datastore is not configured correctly (i.e., you did not install the required guest and admin credentials by running createImmortalDBs.sh). If you are using a couchdb instance that is not persisted, note that you have to run this script every time you deploy. The sequence is:

ant clean build
tools/db/couchdb/start-couchdb-box.sh whisk_admin some_passw0rd
tools/db/createImmortalDBs.sh 
ant deploy
eljuanchosf commented 8 years ago

Ok, so I have installed CouchDB in the same box. Then I run createImmortalDBs.sh. Output of that script is:

./tools/db/createImmortalDBs.sh 
About to drop and recreate database 'subjects' on:
  http://localhost:5984
This will wipe the previous database if it exists and this is not reversible.
Respond with 'DROPIT' to continue and anything else to abort.
Are you sure? DROPIT
subjects
curl -s -k --user lagavulin:singlemalt -X DELETE http://localhost:5984/subjects
{"ok":true}
curl -s -k --user lagavulin:singlemalt -X PUT http://localhost:5984/subjects
{"ok":true}
{"ok":true,"id":"_design/subjects","rev":"1-75bab8a4d7d4cc346954de8deb35e984"}
Create immortal key for guest
{"ok":true,"id":"guest","rev":"1-64f0f9a3b79cb8546c67a1e8631e097c"}
Create immortal key for whisk.system
{"ok":true,"id":"whisk.system","rev":"1-990db25b72e29cb614594f0c8faea2a2"}

Which I think it is Ok, that I'm not seeing errors. But when I do ant deploy I keep seeing the error I specified above.

rabbah commented 8 years ago

In your Vagrant machine, try from the openwhisk directory:

wsk action create hello catalog/samples/hello.js --auth $(cat config/keys/auth.whisk.system)

If that fails, then the key installed in your CouchDB for whisk.system does not match the expected value used during catalog installation. You can verify what that the key in the database wskadmin user get whisk.system matches what is in this file.

eljuanchosf commented 8 years ago

It is weird. Running the hello.js script fails, but the keys seems to match:

~/openwhisk# bin/wskadmin user get whisk.system
789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
~/openwhisk# cat config/keys/auth.whisk.system 
789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
rabbah commented 8 years ago

Do you have a ~/.wskprops file? One more thing to check (note use of -v):

wsk -v action create hello catalog/samples/hello.js --auth $(cat config/keys/auth.whisk.system)
{'apihost': '172.17.0.1', 'namespace': '_', 'clibuild': '2016-05-04T23:27:24-04:00', 'apiversion': 'v1'}
========
REQUEST:
PUT https://172.17.0.1/api/v1/namespaces/_/actions/hello

Does the above match your setup? In particular, is namespace equal to _ and the API end point https://.../api/v1/namespaces/_/actions/hello?

rabbah commented 8 years ago

I notice that the user name and password you use for the Couch instance are not the default values - I assume you updated the generated couchdb-local.env file accordingly.

markusthoemmes commented 8 years ago

Also keep in mind, that everytime you run ant clean the whole docker daemon is cleaned up including the couchDB instance. That means: after each clean you need to redeploy couchdb and create the immortal databases.

It's important to follow the sequence @rabbah lined out above in his comment.

eljuanchosf commented 8 years ago

@rabbah I don't have a .wskprops file in my home. Yes, I did change the username and password in the couchdb-local.env. @markusthoemmes I followed the steps, except for the tools/db/couchdb/start-couchdb-box.sh whisk_admin some_passw0rd, since I have CouchDB installed permanently in my box.

Here is the result of the command you specified:

# wsk -v action create hello catalog/samples/hello.js --auth $(cat config/keys/auth.whisk.system)
{'apihost': '172.17.0.1', 'namespace': '_', 'clibuild': '2016-05-05T03:03:03+00:00', 'apiversion': 'v1'}
========
REQUEST:
PUT https://172.17.0.1/api/v1/namespaces/_/actions/hello
Headers sent:
{
    "Authorization": "Basic Nzg5YzQ2YjEtNzFmNi00ZWQ1LThjNTQtODE2YWE0ZjhjNTAyOmFiY3pPM3haQ0xyTU42djJCS0sxZFhZRnBYbFBrY2NPRnFtMTJDZEFzTWdSVTRWck5aOWx5R1ZDR3VNREdJd1A=",
    "Content-Type": "application/json"
}
Body sent:
{"exec": {"kind": "nodejs", "code": "/**\n * Hello, world.\n */\nfunction main(params) {\n    console.log('hello', params.payload+'!');\n}\n"}}
error: [Errno 111] Connection refused
eljuanchosf commented 8 years ago

There is no issue after all. The problem was with the name of the database host. I'll create a PR with the "workaround" in the README.

Thank you @rabbah and @markusthoemmes for your help!

daisy-ycguo commented 8 years ago

@eljuanchosf I think I met with the same issue with you. I'm running my OpenWhisk in a CouchDB installed in the same server. couchdb-local.env is configured as following:

OPEN_WHISK_DB_PROTOCOL=https OPEN_WHISK_DB_HOST=127.0.0.1 OPEN_WHISK_DB_PORT=6984 OPEN_WHISK_DB_USERNAME=root OPEN_WHISK_DB_PASSWORD=ps

Can you explain more detail about "The problem was with the name of the database host" and how to "workaround" ?

Daisy

markusthoemmes commented 8 years ago

Hi @daisy-ycguo

The problem @eljuanchosf faced was using a non-ephemeral, non-docker couchdb running natively on his system. He tried to use localhost to reach that database but localhost in a container is not your local machine but the container itself.

Does that match your local deployment?

A possible workaround is to use the IP of your machine as DB_HOST instead of localhost or aliases like 127.0.0.1.

daisy-ycguo commented 8 years ago

Hi, @eljuanchosf

Yes, it matched. You can see from my couchdb-local.env, I want to reach my database using https://127.0.0.1:6984, not localhost. I think it's exactly the same situation with @eljuanchosf .

I'm sure my local CouchDB runs well. It can be reached both by https://127.0.0.1:6984 and http://127.0.0.1:5984. I tested by "curl -k https://127.0.0.1:6984" and "curl -k http://127.0.0.1:5984". I'm even quite sure the whisk.system is stored in the database. I can query the data by: curl -s -k --user root:ps -X GET https://127.0.0.1:6984/subjects/whisk.system.

I tried to config https and 6984 in couchdb-local.env, it reported the same error as @eljuanchosf reported when "ant deploy". Then I tried to config http and 5984 in couchdb-local.env, it reported the same error: The supplied authentication is invalid.

It's quite interesting because ./tools/db/createImmortalDBs.sh can successfully insert data to CouchDB, but it looks like wsk cannot. I'm quite curious how @eljuanchosf work it around.

Daisy

daisy-ycguo commented 8 years ago

Oh. I understand. I should use the exact IP address, not IP address: 127.0.0.1 to access CouchDB. Let me try if it works. Thank you, @markusthoemmes

daisy-ycguo commented 8 years ago

Yeah, it works. I changed the IP address in couchdb-local.env to the real IP address, not 127.0.0.1, "ant deploy" runs well. Thank you for the help, @markusthoemmes

lfzCarlosC commented 8 years ago

@daisy-ycguo can you tell me the real ip you mean ? is it the ip of vagrant vm or which command you use to get this ip?

daisy-ycguo commented 8 years ago

@lfzCarlosC I don't use vagrant. I use a Ubuntu VM with a CouchDB installed in the same VM. I don't know if it is similar.

When I type command: ifconfig, I will see three network interfaces and three IP address: docker0 172.17.0.1 eth0 10.0.2.15 lo 127.0.0.1

I choose the IP address of eth0 as the database IP in the database configuration file, i.e. 10.0.2.15. I don't know if that is helpful. If you can explain the detail of your network, I can see if I can help.

Daisy