"cf services" is throwing "You are not authorized to perform the requested action"
Command
"cf services"
What occurred
Returns "You are not authorized to perform the requested action" error
What you expected to occur
List the services in my space.
CLI Version
cf version 6.35.0+5c7de3e32.2018-03-08
CC API Endpoint Version
api version: 2.75.0
CF Trace
"cf services -v" returns the following towards the end: REQUEST: [2018-03-14T13:48:50-07:00] GET /v2/service_plans/92fd5910-eefb-4f4f-947f-4d90f098f659 HTTP/1.1 Host: api.system.aws-usw02-dev.ice.predix.io Accept: application/json Authorization: [PRIVATE DATA HIDDEN] User-Agent: cf/6.35.0+5c7de3e32.2018-03-08 (go1.10; amd64 darwin)
RESPONSE: [2018-03-14T13:48:50-07:00] HTTP/1.1 403 Forbidden Content-Length: 131 Content-Type: application/json;charset=utf-8 Date: Wed, 14 Mar 2018 20:48:50 GMT Server: nginx X-Content-Type-Options: nosniff X-Vcap-Request-Id: 977c16e5-16fd-4f12-68d9-ffa95dfa1203 X-Vcap-Request-Id: 977c16e5-16fd-4f12-68d9-ffa95dfa1203::84ccb9a8-556c-4891-a6c3-6326349107e5 { "code": 10003, "description": "You are not authorized to perform the requested action", "error_code": "CF-NotAuthorized" }
Platform & Shell Details
Mac OS X 10.13.3 iTerm2 3.0.15
Any other relevant information
It works fine with CF CLI 6.34 for the same API endpoint.
We have created an issue in Pivotal Tracker to manage this:
https://www.pivotaltracker.com/story/show/155992614
The labels on this github issue will be updated when the story is started.
Hi @sivabalans, which user roles do you have for this logged in user on this org and space?
You can run the following commands to retrieve this information:
cf org-users ORG
cf space-users ORG SPACE
Below are the output:
$cf org-users predix-acs-perf Getting users in org predix-acs-perf as predix-platform-perf...
ORG MANAGER admin predix-platform-perf
BILLING MANAGER No BILLING MANAGER found
ORG AUDITOR No ORG AUDITOR found
$cf space-users predix-acs-perf predix-acs-perf Getting users in org predix-acs-perf / space predix-acs-perf as predix-platform-perf
SPACE MANAGER admin predix-platform-perf
SPACE DEVELOPER admin predix-platform-perf predix-uom-deployer
SPACE AUDITOR No SPACE AUDITOR found
On Wed, Mar 14, 2018 at 3:12 PM, An Yu [email protected] wrote:
Hi @sivabalans https://github.com/sivabalans, which user roles do you have for this logged in user on this org and space?
You can run the following commands to retrieve this information: cf org-users ORG cf space-users ORG SPACE
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cloudfoundry/cli/issues/1344#issuecomment-373192279, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ-Cirhae1KlrK0yvgvgQRx7fCovzH3kks5teZW4gaJpZM4SrKHa .
-- http://www.twitter.com/sivabalans
We aren't able to reproduce this bug. Can you post the whole -v output for the services command?
@anyu - There is too much sensitive information in the output of -v. I need to find a way to scrub it before I post it here. But from what I can see, the difference seem to be in the /v2/service_plans/
@sivabalans we were able to reproduce the problem, we're currently looking into solutions right now.
The reason this is happening is because this org/space has an instance of a service that has been disabled for this particular org/space (or the system) that it previously had access to.
A temporary solution (using the newer CLI) is to enable-service-access back to this org. Another option is just to keep using the previously working CLI.
Hi @sivabalans, we may have fixed this issue. Can you please try to reproduce it with a latest edge build of the CF CLI from here?
We will await your feedback before publishing a fix to the community.
I tried it with the edge binary. Below are my observations:
- It still throws a bunch of errors before it returns the results for "cf services". But this time I do see the results eventually unlike before.
- Below are the errors:
GC02PW2WZG8WME:Downloads 212356793$ cf-cli_edge_osx/cf services Getting services in org predix-acs-perf / space predix-acs-perf as predix-platform-perf...
This org is not authorized to view necessary data about this service plan. Contact your administrator regarding service GUID 92fd5910-eefb-4f4f-947f-4d90f098f659. This org is not authorized to view necessary data about this service plan. Contact your administrator regarding service GUID 92fd5910-eefb-4f4f-947f-4d90f098f659. This org is not authorized to view necessary data about this service plan. Contact your administrator regarding service GUID 8d55195f-df82-4de2-8a96-6793eed41bad. This org is not authorized to view necessary data about this service plan. Contact your administrator regarding service GUID 8d55195f-df82-4de2-8a96-6793eed41bad. This org is not authorized to view necessary data about this service plan. Contact your administrator regarding service GUID b7ff68be-81d4-425a-ae0f-75a26ce35d91. This org is not authorized to view necessary data about this service. Contact your administrator regarding service GUID 17b034a7-fe03-4b12-a6ea-b24626b40ea6.
name service plan bound apps
last operation
acs-asset-uaa predix-uaa
create succeeded
acs-asset predix-asset Tiered acs-asset-adapter
create succeeded
- Also, "cf services" command now takes 20 seconds to return the results:
real 0m19.742s user 0m0.346s sys 0m0.187s
- When I run the same "cf services" command with the 6.34 version of CLI, it returns no errors and the results come back in 2 seconds:
real 0m2.289s user 0m0.156s sys 0m0.042s
Hope this helps.
Thanks, Siva
On Fri, Mar 16, 2018 at 10:25 AM, Nick Wei [email protected] wrote:
Hi @sivabalans https://github.com/sivabalans, we may have fixed this issue. Can you please try to reproduce it with a latest edge build of the CF CLI from here https://github.com/cloudfoundry/cli#edge-binaries?
We will await your feedback before publishing a fix to the community.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cloudfoundry/cli/issues/1344#issuecomment-373785898, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ-CivtjITtpRudA9Wk_pFUiIFf3Zj4Mks5te_V2gaJpZM4SrKHa .
-- http://www.twitter.com/sivabalans
Just a quick update. The edge CLI takes 20 seconds to return the results and not 1min and 6 sec as stated originally in the previous comment. I udpated the comment.
@sivabalans thank you for verifying this. What you are seeing above is the new expected behavior. Please read on for the explanation.
- The
servicescommand used to make a single request to a summary endpoint to retrieve information displayed in theserviceandplancolumns. However, the summary endpoint on the API side has a pagination bug that does not allow it to return beyond 50 results. As a result, we are individually gettingserviceandplaninformation for each service instance and this inherently takes longer. - As a result of individually getting
serviceandplaninformation, you helped us discover a bug in the API where it returns 403s. After weighing different solutions and tradeoffs, we decided to display the warnings you see above for resources we do not have access to; and display what information we are able to retrieve from the API and still exit 0.
Please feel free to voice any concerns you may have.
@nickwei84 thanks for the explanation. I presume until the pagination bug for the summary endpoint API is fixed, we have to live with those warnings. That should be fine for now.
how to solve this problem?
how to solve this problem?