cancel
Showing results for 
Search instead for 
Did you mean: 

html5-repo managed application router error creating service while deploying to CF

03-07-2021 8:08 PM
patrickwenger Participant
4956 views 9 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Hi

I am trying to deploy a simple backend service which I built in BAS together with a sap ui5 frontend to the launchpad service in CF. I'd like to use the managed application router modell since I have no special requirements for the app. For some reason I am not able to accomplish this rather normal requirement. To be honest I doubt myself why I am not able to do this. I was looking all around the net (starting of course here in the community) for some help but there is either always something different with the scenario or it doesn't work. The closest I came is by following this sample app from Marius Obert: https://github.com/SAP-samples/multi-cloud-html5-apps-samples/tree/master/managed-html5-runtime-basi.... I can build the mta archive with

npm install
npm run build

but when I deploy it to the Cloud Foundry with

cf deploy mta_archives/hello-world_1.0.0.mtar

I get the following error:

Creating service "hello-world-destination-service" from MTA resource "hello-world-destination-service"... Service operation failed: Controller operation failed: 502 Updating service "hello-world-destination-service" failed: Bad Gateway: Error creating service "hello-world-destination-service" from offering "destination" and plan "lite": CF-ServiceBrokerBadResponse(10001): Service broker error: Service broker destination-service-broker failed with: Failed to create a destination service instance with the user provided configuration.

This part about updating the service "hello-world-destination-service" is strange since there is no such service in my trial account. However, I can then create the service myself using the information in the log file:

cf dmol -i af776a2f-7f72-11eb-90af-eeee0a87ce44
#2.0#2021 03 07 12:55:42.313#Z#DEBUG#com.sap.cloud.lm.sl.xs2.528e4108-7f44-11eb-9859-eeee0a92c5cb.OPERATION.CreateServiceTask# ######org.cloudfoundry.multiapps.controller.persistence.services.ProcessLogger########flowable-async-job-executor-thread-70290### [CreateServiceStep] Getting service instance "hello-world-destination-service"...#
#2.0#2021 03 07 12:55:42.492#Z#DEBUG#com.sap.cloud.lm.sl.xs2.528e4108-7f44-11eb-9859-eeee0a92c5cb.OPERATION.CreateServiceTask# ######org.cloudfoundry.multiapps.controller.persistence.services.ProcessLogger########flowable-async-job-executor-thread-70290### [CreateServiceStep] Creating service instance: { "isOptional" : false, "isManaged" : true, "name" : "hello-world-destination-service", "v3Metadata" : { "annotations" : { "mta_id" : "hello-world", "mta_version" : "1.0.0", "mta_resource" : "{\"name\":\"hello-world-destination-service\"}" }, "labels" : { "mta_id" : "2095312189753de6ad47dfe20cbe97ec" } }, "label" : "destination", "plan" : "lite", "credentials" : "********", "tags" : [ ], "type" : "managed_service_instance", "alternativeLabels" : [ ], "resourceName" : "hello-world-destination-service", "shouldSkipParametersUpdate" : false, "shouldSkipPlanUpdate" : false, "shouldSkipTagsUpdate" : false }#

When I created the destination serve by myself I can then retry the deploy operation:

cf deploy -i af776a2f-7f72-11eb-90af-eeee0a87ce44 -a retry

The deploy process finishes then without any error. But of course, the app is not working. I get the URL for the html5 app like this:

cf html5-list -di hello-world-destination-service -u

I then change the "...cpp...." in the URL to "...launchpad... Unfortunately this is not working. I just get a "Internal Server Error". In the browser console (F12) there is not much more to see: "Failed to load resource: the server responded with a status of 500 (Internal Server Error)"

I don't know what to do. I read a lot and also tried a lot but nothing worked out. Any help would be greatly appreciated.

Thanks a lot

Patrick

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

mariusobert
Developer Advocate
Developer Advocate
0 Likes

Sorry for the inconvenience. This seems to be a problem for trial accounts in EU10 and the team is already working on a fix.
PS: The service works in other regions like APJ21. Feel free to create a subaccount in that region as a temporary workaround.

patrickwenger
Participant

Thank you very much for this information. I really was going crazy. Now everything works as expected. Great!

Patrick

carlonnheim
Participant
0 Likes

We have the same issue in our productive environment. Deploying the same mta in another subaccount on eu20 works fine. Can we expect a fix soon?

mariusobert
Developer Advocate
Developer Advocate
0 Likes

I'm afraid I don't know more on that. Please open a support ticket if you need more details.
Sorry.

Answers (3)

Answers (3)

yuval_morad
Product and Topic Expert
Product and Topic Expert
0 Likes

We can have a short call contact me in mail

yuval_morad
Product and Topic Expert
Product and Topic Expert
0 Likes

Have a look here

https://github.wdf.sap.corp/I022947/SAPITMTA.git

My package.json looks different

{ "name": "sapitmta", "version": "0.0.1", "devDependencies": { "@sap/approuter": "^9.0.1", "@sap/html5-repo-mock": "^2.0.1", "bestzip": "2.1.4", "rimraf": "3.0.2" } }

make sure you subscribe to launchpad or portal SaaS in the same subaccount BAS is subscribed

patrickwenger
Participant
0 Likes

Thanks for your reply. Unfortunately I have no access to the link you provided. This seems to be some SAP internal stuff.

The differences of your package.json file are only devDependencies which are unlikely to produce problems in the deployment process. However, I added the devDependencies to my package.json file and tried again without success. The same error messages.

Your help is greatly appreciated.

Patrick

yuval_morad
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi

Which template did you use?

Please share

1. project structure

2. MTA.yaml

3. manifest.json

4. package.json

5. xs-app.json

patrickwenger
Participant
0 Likes

Hi Yuval

I used the code from the github repository that I mentioned. For the development space I used the "SAP Cloud Business Application" template. Then I just cloned the repository of Marius Obert. The files are like follows:

Project structure:

Project Root
-- HTML5Module
-- -- index.html
-- -- manifest.json
-- -- package.json
-- -- xs-app.json
-- mta.yaml
-- package.json
-- xs-security.json

MTA.yaml:

_schema-version: "3.2"
ID: hello-world
version: 1.0.1

build-parameters:
  before-all:
    - builder: custom
      commands:
        - npm install

modules:
  - name: hello-world-destination-content
    type: com.sap.application.content
    requires:
      - name: hello-world_uaa
        parameters:
          service-key:
            name: hello-world_uaa-key
      - name: hello-world_html_repo_host
        parameters:
          service-key:
            name: hello-world_html_repo_host-key
      - name: hello-world-destination-service
        parameters:
          content-target: true
    parameters:
      content:
        instance:
          destinations:
            - Name: my_service_hello_world_html_repo_host
              ServiceInstanceName: hello-world_html_repo_host
              ServiceKeyName: hello-world_html_repo_host-key
              sap.cloud.service: basic.service
            - Authentication: OAuth2UserTokenExchange
              Name: my_service_uaa_hello_world
              ServiceInstanceName: hello-world_uaa
              ServiceKeyName: uaa_hello-world-key
              sap.cloud.service: basic.service
          existing_destinations_policy: update
    build-parameters:
      no-source: true
  - name: hello-world_ui_deployer
    type: com.sap.application.content
    path: .
    requires:
      - name: hello-world_html_repo_host
        parameters:
          content-target: true
    build-parameters:
      build-result: resources
      requires:
        - artifacts:
            - HTML5Module-content.zip
          name: HTML5Module
          target-path: resources/
  - name: HTML5Module
    type: html5
    path: HTML5Module
    build-parameters:
      builder: custom
      commands:
        - npm run build
      supported-platforms: []
resources:
  - name: hello-world-destination-service
    type: org.cloudfoundry.managed-service
    parameters:
      service: destination
      service-name: hello-world-destination-service
      service-plan: lite
      config:
        HTML5Runtime_enabled: true
        version: 1.0.0
  - name: hello-world_html_repo_host
    type: org.cloudfoundry.managed-service
    parameters:
      service: html5-apps-repo
      service-plan: app-host
  - name: hello-world_uaa
    type: org.cloudfoundry.managed-service
    parameters:
      path: ./xs-security.json
      service: xsuaa
      service-plan: application

manifest.json:

{
  "_version": "1.12.0",
  "sap.app": {
    "id": "helloworld",
    "type": "application",
    "title": "Basic Web App",
    "applicationVersion": {
      "version": "1.0.0"
    }
  },
  "sap.cloud": {
    "service": "basic.service"
  },
  "sap.ui5": {
    "dependencies": {
        "minUI5Version": "1.65.0"
    },
    "contentDensities": {
        "compact": true,
        "cozy": true
    }
  }
}

package.json:

{
    "name": "managed-html5-runtime-basic-mta",
    "dependencies": {
        "mbt": "^1.1.0"    },
    "scripts": {
        "build": "mbt build"
    },
    "version": "1.0.0"
}

xs-app.json:

{
  "welcomeFile": "/index.html",
  "authenticationMethod": "route",
  "routes": [
    {
      "source": "^(.*)$",
      "target": "$1",
      "service": "html5-apps-repo-rt",
      "authenticationType": "xsuaa"
    }
  ]
}