on 2023 Mar 31 5:38 PM
I am learning CAP and i am struck with the following issue. Seeking community help to help me fix and learn. I created a CAP service (sample bookshop srv) and deployed the application to BTP. While executing the app router locally, i can see the data is fetched correctly and data is displayed in the UI5 application. But after deploying to BTP, when i run the app router i get the error, Service Unavailable.
the service call returns 503 service unavailable when executed through App router, and 401 unauthorized when running the service instance. I did not define any restriction in my CAP Service.
I tried deleting the services and deploy it again. I tried adding a role in the xs-security.json and assigned the role to my user. It did not work. I have attached the mta.yaml, xs-app.json, xs-security.json file. i appreciate if someone can help.
Thanks,
Arun K
Request clarification before answering.
This blog post is already old, but what helped me with the exact 503 message after deployment to BTP CF, even with App Router and correct setup was, that it looks for the destination not on subaccount upper level but within the CF Space and the service instance itself. So you have to specify the explicite destination for destination service instance in the corresponding UI. Afterwards, it can connect via destination and cloud connector.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A couple of ideas to investigate the issue.
1. Open another terminal and log the output of the app router `cf logs exercise2`. Then run the request again and see what output you get in the terminal.
2. The service instance should return a 401 if you try to call directly. In order to test it individually you can create a service key on your exercise2-auth instance and then use the information to retrieve a bearer token and then call your exercise-srv with the Bearer token in the Authorization header.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Martin,
When I deployed the mta.yaml file, only the auth instance got created. The service instance did not create. So i run the following command `cf create-service-key exercise2-auth default` to create the service key and then bind the service key using `cds bind -2 exercise2-auth:default` but still the service returns me error. Then i tried to redeploy from mta.yaml file, i got the error saying the old xsuaa instance and the new xsuaa instance id is different, cannot modify. what is the best approach to create the xsuaa instance and its service key.
Thanks & Regards,
Arun K
Hi Martin,
I am following this tutorial: Link to the tutorial
https://github.com/arunkrishnamoorthy/cap-local-auth-setup.git
I am using trial instance, business application studio. After deploying when i run the app router, i get the following message when calling odata service.
Regards,
Arun K
Arun, there seem to be a few things wrong in your current project. Let's answer the previous question first. If you want to test your service without the app router you can create a file (I usually create it in a new sub directory I call 'test') with a name like 'testrest.http' (the http extension is important). Then you want to copy and paste the following into it:
# Information from UAA service key ('cf csk exercise6-xsuaa-service mstest' and then 'cf service-key exercise6-xsuaa-service mstest')
@clientid=[fill in]
@clientsecret=[fill in]
@uaa_url=[fill in]
# URL from your service as shown during deployment of you can find with 'cf apps' in the 'route' column. Don't forget to prefix with https://
@service_url=https://[fill in]
# OAUTH 2.0 Client Credentials
# @name Bearer_Token_Request
POST {{uaa_url}}/oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials
&client_id={{clientid}}
&client_secret={{clientsecret}}
####
GET {{service_url}}/catalog/Interactions_Header
Authorization: Bearer {{Bearer_Token_Request.response.body.access_token}}
####
POST {{service_url}}/catalog/Interactions_Header
Authorization: Bearer {{Bearer_Token_Request.response.body.access_token}}
Content-Type: application/json
{
"ID":1,
"PARTNER":"RIZ"
}
The in Business Application studio you should have the words 'Send Request' over the get and post lines. Execute the bearer token request first and then run the get or post. That should work.
On my machine I could not even successfully deploy your repo via 'mbt build' and 'cf deploy'. The first thing that was a problem is that your package.json in the app directory has references to old node engines. You probably want to take that section out.
The next thing that I believe is incorrect is your mta.yaml is the ui_deployer section. Have another look through the exercise and make sure you either correct or redo the UI sections.
As an alternative I can also offer our step by step repo: https://github.com/RizInno/cds-customer-stepbystep
Hi Martin,
I was checking the service from the postman and authenticating the service to see if the service returns the data. I got the same error 503 service unavailable. I checked the logs using cf logs exercise6-srv --recent and the message was related to the maximum no of pools. I saw you response in one of the similar issue raised here and maintained the following in the package.json file.
"db": { "kind": "hana-cloud", "pool": { "max": 100, "min": 10 } },Now I am getting this message. Socket hung up. Any idea how I can fix this. Error: error while forwarding request to
https://71bd99e1trial-dev-exercise6-srv.cfapps.us10-001.hana.ondemand.com/catalog/Interactions_Heade...: socket hang up correlation_id = b87dd50e-c9b0-4c9a-7033-93e296d7fcf3
Regards,
Arun K
User | Count |
---|---|
31 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.