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

VCAP_Services Error #33

Open
movinglightspeed opened this issue Jan 12, 2021 · 3 comments
Open

VCAP_Services Error #33

movinglightspeed opened this issue Jan 12, 2021 · 3 comments

Comments

@movinglightspeed
Copy link

https://github.com/IBM-Cloud/get-started-python/blob/master/hello.py

Waiting for app to start...
Start unsuccessful

TIP: use 'cf.exe logs myapp --recent' for more information
FAILED

ibmcloud cf logs myapp --recent
2021-01-12T06:02:32.28-0600 [CELL/0] OUT Starting health monitoring of container
2021-01-12T06:02:39.91-0600 [APP/PROC/WEB/0] ERR Traceback (most recent call last):
2021-01-12T06:02:39.91-0600 [APP/PROC/WEB/0] OUT Found VCAP_SERVICES
2021-01-12T06:02:39.94-0600 [APP/PROC/WEB/0] ERR File "hello.py", line 19, in
2021-01-12T06:02:39.94-0600 [APP/PROC/WEB/0] ERR password = creds['password']
2021-01-12T06:02:39.94-0600 [APP/PROC/WEB/0] ERR KeyError: 'password'
2021-01-12T06:02:40.43-0600 [APP/PROC/WEB/0] OUT Exit status 1
2021-01-12T06:02:40.49-0600 [CELL/SSHD/0] OUT Exit status 0

From GUI
TypeInstanceLogsTime
APP/PROC/WEB0Traceback (most recent call last):

Jan 12, 2021, 05:42:07 AM

APP/PROC/WEB0 File "hello.py", line 19, in

Jan 12, 2021, 05:42:07 AM
APP/PROC/WEB0 password = creds['password']

Jan 12, 2021, 05:42:07 AM
APP/PROC/WEB0KeyError: 'password'

Jan 12, 2021, 05:42:07 AM

@movinglightspeed
Copy link
Author

update: I realized the reason was because the cloudant database was IAM only not IAM + Legacy which supports the username + password.

It would be good if the code was updated to support also the IAM only cloudant database offering, offering support for the IAM apikey + access token support as iam apikey alone can't authenticate against a cloudant database as stated from docs:

https://github.com/IBM/cloudant-python-sdk#iam-authentication

"You can't use an IAM API key directly to authenticate against IBM Cloudant."
https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-connecting

It would be great to see a implementation of IAM API key + Access token in a python app starter code

@emlaver
Copy link

emlaver commented Jan 12, 2021

Just to clarify, while you can't use an IAM API key directly when using cURL (you must first get an IBM Cloud IAM token by using an API key) you can use the IAM API key to authenticate in our python-cloudant library.
There's an example of authenticating with IAM in our python-cloudant documentation.

@movinglightspeed
Copy link
Author

movinglightspeed commented Jan 15, 2021

@emlaver Thanks for clarifying that! That was it, that statement in the documentation caused alot of confusion. To further add to my wrong conclusions, starter kits all used legacy creds, led me to believe iam didn't work for apps and thought what a security risk!

This cleared it up and I used the code in the example you shared and successfully tested an app connection to the db. I was able to create, update using iam connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants