-
Notifications
You must be signed in to change notification settings - Fork 43
[BUG] Error authenticating CF instance (wrong CF API endpoint) #257
Comments
Hi @rkapoz-bgp , |
Hi, no I didn't change any setting in parameter.json (I thing the attribute you are referring have been modified the first time i run btpsa. here an extract of the contents: "usecasefile": "usecases/released/default.json", |
@rkapoz-bgp : I tried to reproduce the error you reported but did not succeed. My setup:
I tried the execution with basic authentication as well as well as sso. In all runs the CF environment was created successfully including org and space. [2022-10-15 14:28:29] RUN COMMAND: cf login -a 'https://api.cf.us10.hana.ondemand.com' -o 'cf-btp-setup-automator-us10-<a cryptical uuid>' -u '[email protected]' -p 'xxxxxxxxxxxxxxxxx
[2022-10-15 14:28:33] RUN COMMAND: cf spaces
[2022-10-15 14:28:34] CHECK : cfspacename >development<
[2022-10-15 14:28:34] CHECK : org >cf-btp-setup-automator-us10-<a cryptical uuid><
[2022-10-15 14:28:34] INFO : Create CF space >development<
[2022-10-15 14:28:34] RUN COMMAND: cf create-space 'development' -o 'cf-btp-setup-automator-us10-<a cryptical uuid>'
[2022-10-15 14:28:36] INFO : Check when CF space >development< is ready
[2022-10-15 14:28:36] RUN COMMAND: cf spaces
[2022-10-15 14:28:37] SUCCESS : created CF space >development<
[2022-10-15 14:28:37] INFO : Set CF target to space >development<
[2022-10-15 14:28:37] RUN COMMAND: cf target -s 'development' The endpoint works correct. Using the btpcli command you referenced, I get two entries, one with the landscape label For comparison: {
"$schema": "https://raw.githubusercontent.com/SAP-samples/btp-setup-automator/main/libs/btpsa-parameters.json",
"usecasefile": "usecases/released/default.json",
"region": "us10",
"globalaccount": null,
"myemail": "[email protected]",
"loginmethod": "basicAuthentication",
"subaccountname": null,
"cfspacename": "development"
}
{
"$schema": "https://raw.githubusercontent.com/SAP-samples/btp-setup-automator/main/libs/btpsa-usecase.json",
"aboutThisUseCase": {
"name": "Default use case on how to show how btp-setup-automator works",
"description": "This usecase sets up various services and app subscriptions on SAP BTP",
"author": "[email protected]",
"testStatus": "tested successfully",
"usageStatus": "READY TO BE USED"
},
"services": [
{
"name": "application-logs",
"plan": "lite",
"category": "SERVICE"
},
{
"name": "xsuaa",
"plan": "apiaccess",
"category": "SERVICE"
},
{
"name": "sapappstudio",
"plan": "standard-edition",
"category": "APPLICATION"
},
{
"name": "cicd-app",
"plan": "default",
"category": "APPLICATION"
}
]
} If you see a delta compared to yours let me know. |
Hi @lechnerc77, I confirm the strange thing about the CF API endpoint that I see on the BTP cockpit (https://api.cf.us10-001.hana.ondemand.com/), and if I manually logon (via CF cli) with this endpoint the connection works, and I see the org created. I'm using an CPEA BTP account; if this hepl, it has been provisioned just some days ago (I'm thinking about a new "feature" added to new global accounts/subdomain, that modified the CF API url, may be?). As I reported above, if I run btp --format json list accounts/available-environment --subaccount I receive a JOSN with an element called "landscapeLabel": "cf-us10-001" that seems referring the "001" missing in the CF API URL endpoint (as referenced in the automator) |
@rkapoz-bgp Thanks for your quick feedback. Maybe this is due to the CPEA BTP account, but I do not think so. As I wrote, I get back two entries from the BTP CLI command, one with landscape label *us10 and one with *us10-100. I will check what causes this different endpoint that does not seem to be documented (at least I did not find it) |
@rkapoz-bgp as you already mentioned the wrong API endpoint was used. I have fixed the behavior via PR #259 fetching the endpoint information from the BTP CLI The fixed code is available in the latest |
Hi @lechnerc77 , I confirm it works. Thank you |
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
Are you using the latest docker image for BTPSA?
Which area is mainly impacted
Cloud Foundry setups
Current Behavior
I'm trying to setup one "sample" BTP env with the default settings in the image container (default.json settings). At the time of connecting to the CF endpoint and connect to the auto-created org, I receive an error indicating that the ORG (just created, and exists) does not exists
ERROR : Organization 'cf-btp-setup-automator-us10-998b9f87-fa30-4934-9295-6903ab7f' not found.
After investigating the issue, I found that the code refers to the CF API endpoint as: https://api.cf.us10.hana.ondemand.com , but the real actual CF endpoint is: https://api.cf.us10**-001**.hana.ondemand.com/
It seems it added to the API URI an "landscapelabel" (001) that is referenced in the btp_cli.py file (from line 323
envLandscape = selectEnvironmentLandscape(self, environment)
Effectively running the command (from cli)
btp --format json list accounts/available-environment --subaccount <my account>
I see a property "landscapeLabel": "cf-us10-001" , but as far I can understand, is not used to properly format the CF API URL (I searched for but I haven't found anything about th eproperty "landscapeLabel")Expected Behavior
No response
Steps To Reproduce
1 I'm using the latest docker image container (commit id: 0724fc0)
2 run ./btpsa with default settings (by using the default parameters.json file and default usecases/released/default.json)
Logs and configuration files available?
[2022-10-15 10:05:42] RUN COMMAND: cf login -a 'https://api.cf.us10.hana.ondemand.com' -o 'cf-btp-setup-automator-us10-998b9f87-fa30-4934-9295-6903ab7f' -u '[email protected]' -p 'xxxxxxxxxxxxxxxxx
[2022-10-15 10:05:45] ERROR : API endpoint: https://api.cf.us10.hana.ondemand.com
Authenticating...
OK
API endpoint: https://api.cf.us10.hana.ondemand.com
API version: 3.123.0
user: [email protected]
No org or space targeted, use 'cf target -o ORG -s SPACE'
FAILED
[2022-10-15 10:05:45] ERROR : Organization 'cf-btp-setup-automator-us10-998b9f87-fa30-4934-9295-6903ab7f' not found.
Anything else?
No response
The text was updated successfully, but these errors were encountered: