Skip to Content
0

500 Internal Server Error - Invalid HANA settings provided. OData services are disabled?

Feb 17, 2017 at 09:52 AM

1.5k

avatar image
Former Member

I try to run the OData Service on my SAP HANA HXE and get this error if I run the node.js-module within the Odata Service and go the xsodata-path. How could I solve this to get a correct ODataV2-Service?

I tried to set NODE_TLS_REJECT_UNAUTHORIZED: 0 in the MTA.yaml file, but this didn't solve the error.

500 Internal Server Error - Invalid HANA settings provided. OData services are disabled.
Error: Internal Server Error - Invalid HANA settings provided. OData services are disabled.
    at /hana/shared/HXE/xs/controller_data/executionagent/executionroot/6d27693a-a555-497d-ac73-37558c6e4024/app/node_modules/sap-xsjs/lib/index.js:107:14
    at Layer.handle [as handle_request] (/hana/shared/HXE/xs/controller_data/executionagent/executionroot/6d27693a-a555-497d-ac73-37558c6e4024/app/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/hana/shared/HXE/xs/controller_data/executionagent/executionroot/6d27693a-a555-497d-ac73-37558c6e4024/app/node_modules/express/lib/router/index.js:312:13)
    at /hana/shared/HXE/xs/controller_data/executionagent/executionroot/6d27693a-a555-497d-ac73-37558c6e4024/app/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/hana/shared/HXE/xs/controller_data/executionagent/executionroot/6d27693a-a555-497d-ac73-37558c6e4024/app/node_modules/express/lib/router/index.js:330:12)
    at next (/hana/shared/HXE/xs/controller_data/executionagent/executionroot/6d27693a-a555-497d-ac73-37558c6e4024/app/node_modules/express/lib/router/index.js:271:10)
    at urlRewriteMiddleware (/hana/shared/HXE/xs/controller_data/executionagent/executionroot/6d27693a-a555-497d-ac73-37558c6e4024/app/node_modules/sap-xsjs/lib/middleware.js:38:5)
    at Layer.handle [as handle_request] (/hana/shared/HXE/xs/controller_data/executionagent/executionroot/6d27693a-a555-497d-ac73-37558c6e4024/app/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/hana/shared/HXE/xs/controller_data/executionagent/executionroot/6d27693a-a555-497d-ac73-37558c6e4024/app/node_modules/express/lib/router/index.js:312:13)
    at /hana/shared/HXE/xs/controller_data/executionagent/executionroot/6d27693a-a555-497d-ac73-37558c6e4024/app/node_modules/express/lib/router/index.js:280:7



My Mta looks like this and in the nodedb are the hbcds and hdbtabledata.file

_schema-version: '2.0'
ID: watson
version: 0.0.1


modules:
- name: nodedb
  type: hdb
  path: nodedb
  requires:
  - name: hdi-container


 
- name: tinyjs
  type: nodejs
  path: tinyjs
  requires:
    - name: nodedb
    - name: hdi-container
    
- name: odatajs
  type: nodejs
  path: odatajs
  requires:
    - name: nodedb
    - name: hdi-container
  provides:
    - name: odatajs_api
      properties:
        service_url: ${default-url}
        
- name: test
  type: html5
  path: agent


- name: table
  type: html5
  path: table


resources:
 - name: hdi-container
   properties:
      hdi-container-name: ${service-name}
      type: com.sap.xs.hdi-container
     
   


My xsodata-file: vendormodel is the context and Audit the table:

service {
         "watson.nodedb::vendormodel.Audit" as "MyTable";
}

10 |10000 characters needed characters left characters exceeded

How does your nodejs startjup file (e.g. server js) look like, respectively the coding which prepares the xsjs environment with injecting the hana options?

Further question is how you configured your xs-app.json in the html5 module which is used to access the odata service? I would have expected a destination configuration in the mta.yml for the required odatajs_api which is then used in the router config.

1
Former Member
Florian Pfeffer

I will use the Odata-service in the new master-detail fiori app. The html5-modules test and table don't use the OData-Service, now.

I need the metadata to create the master-detail template.

My server.js file looks like this and I use the standard package.json.

What do I need to correct?

/*eslint no-console: 0, no-unused-vars: 0*/
"use strict";


var xsjs  = require("sap-xsjs");
var xsenv = require("sap-xsenv");
var port  = process.env.PORT || 3000;


var options = {
	anonymous : true, // remove to authenticate calls
	redirectUrl : "/index.xsjs"
};




// configure HANA
try {
	options = Object.assign(options, xsenv.getServices({ hana: {tag: "hana"} }));
} catch (err) {
	console.log("[WARN]", err.message);
}


//configure UAA
//try {
//	options = Object.assign(options, xsenv.getServices({ uaa: {tag: "xsuaa"} }));
//} catch (err) {
//	console.log("[WARN]", err.message);
//}


// start server
xsjs(options).listen(port);


console.log("Server listening on port %d", port);


<br>

My hdi-namespace file:

{"name":    "","subfolder": "ignore"}
0

Ok, so you wanna access the OData service via the application url of the nodejs module.

The coding looks fine (as it is generated :-)).

Have you debugged the server.js file at the place "options = Object.assign(options, xsenv.getServices({ hana: {tag: "hana"} }));" to check if the information about the HANA service could be determined (you can also write the line "console.log(options)" behind the line, to output the information in the console for test purposes.

1
Former Member
Florian Pfeffer

I get following output, if I output the hana object:

Application is starting
2/20/17 7:36:54.773 AM [APP/2-0] OUT
2/20/17 7:36:54.773 AM [APP/2-0] OUT > odatajs@1.0.0 start /hana/shared/HXE/xs/controller_data/executionagent/executionroot/2695942f-b564-4f21-8f8b-ac73f01eafd0/app
2/20/17 7:36:54.774 AM [APP/2-0] OUT > node server.js
2/20/17 7:36:54.774 AM [APP/2-0] OUT
2/20/17 7:36:55.991 AM [APP/2-0] OUT [WARN] No service matches hana
2/20/17 7:36:56.013 AM [APP/2-0] OUT { anonymous: true, redirectUrl: '/index.xsjs' }
2/20/17 7:36:56.052 AM [APP/2-0] OUT Server listening on port 55002
Application is running
<br>

What's wrong? Did I use the wrong port to acces the odata service?

The application is running on https://hxehost:51020/, but no service matches hana. How could I match the service?

0

You get the warning 'No service matches hana'. That means that no hdi-container service could be determined which is tagged with 'hana'. Can you check that everything is correct with your hdi-container and the service is up and running.

0
Former Member
Florian Pfeffer

Build of nodedb failed because of "no service definition found.You are right there is the problem. How could I define that service or create that service?

11:01:17 (Builder) Build of /watson/nodedb started. 11:01:20 (DIBuild) Build of /watson/nodedb in progress 11:01:22 (DIBuild) ********** Printing /watson/nodedb Build Log **********
[INFO] Injecting source code into builder...
[INFO] Source code injection finished
[INFO] ------------------------------------------------------------------------
cache found, retrieving node modules from cache

> deploy@ start /hana/shared/HXE/xs/controller_data/executionagent/executionroot/83e3757e-5608-42b7-84d8-d33b3ab3d8b1/app/META-INF/.java_xs_buildpack/tomcat/temp/builder/hdi-builder/builds/build-3959210442205579328/nodedb
> node node_modules/sap-hdi-deploy/deploy.js

Error: no service definition found; there must be at least one service definition for the deployment target
(0s 172ms)

npm ERR! Linux 3.12.49-11-default
npm ERR! argv "/hana/shared/HXE/xs/controller_data/executionagent/executionroot/83e3757e-5608-42b7-84d8-d33b3ab3d8b1/app/META-INF/resources/nodejs/vendor/node6.9/bin/node" "/hana/shared/HXE/xs/controller_data/executionagent/executionroot/83e3757e-5608-42b7-84d8-d33b3ab3d8b1/app/META-INF/resources/nodejs/vendor/node6.9/lib/node_modules/npm/bin/npm-cli.js" "start"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! deploy@ start: `node node_modules/sap-hdi-deploy/deploy.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the deploy@ start script 'node node_modules/sap-hdi-deploy/deploy.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the deploy package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node node_modules/sap-hdi-deploy/deploy.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs deploy
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls deploy
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /hana/shared/HXE/xs/controller_data/executionagent/executionroot/83e3757e-5608-42b7-84d8-d33b3ab3d8b1/app/META-INF/.java_xs_buildpack/tomcat/temp/builder/hdi-builder/builds/build-3959210442205579328/nodedb/npm-debug.log

********** End of /watson/nodedb Build Log ********** 11:01:22 (Builder) Check console logs for details 11:01:22 (Builder) Build of /watson/nodedb failed.
0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Florian Pfeffer
Feb 20, 2017 at 10:42 AM
0

Can you correct the indendation for the type of the hdi-container resource (the type should not be listed under properties):

 - name: hdi-container
   type: com.sap.xs.hdi-container
   properties:
      hdi-container-name: ${service-name}
Show 5 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks to you , this was one mistake of my application, but if I try to run the odata-service under the link I get following error codes, if I use the schema HQ8PUPG1X3OVKLDK_VENDOR or the watson.nodedb namespace. I have more than 1 hdi-container in the database explorer, is this a problem?

How could I delete the hdi-containers that I don't need?

https://hxehost:51018/srv1.xsodata

{"error":{"code":404,"message":{"lang":"en-US","value":"No data found for watson.nodedb::vendormodel.Audit table."}}}
{"error":{"code":500,"message":{"lang":"en-US","value":"Invalid schema"}}}
2/21/17 5:43:08.798 PM [APP/1-0] OUT > odatajs@1.0.0 start /hana/shared/HXE/xs/controller_data/executionagent/executionroot/2241d5d2-4449-4ed5-9777-e5a69ca23a90/app
2/21/17 5:43:08.799 PM [APP/1-0] OUT > node server.js
2/21/17 5:43:08.799 PM [APP/1-0] OUT
2/21/17 5:43:10.029 PM [APP/1-0] OUT { anonymous: true,
2/21/17 5:43:10.029 PM [APP/1-0] OUT redirectUrl: '/index.xsjs',
2/21/17 5:43:10.029 PM [APP/1-0] OUT hana:
2/21/17 5:43:10.029 PM [APP/1-0] OUT { schema: 'HQ8PUPG1X3OVKLDK_VENDOR',
2/21/17 5:43:10.029 PM [APP/1-0] OUT hdi_password: 'Aa_96714763483483780897406287503825123651039239272724523156842398382',
2/21/17 5:43:10.029 PM [APP/1-0] OUT password: 'Aa_31321009386636748651143293372572062948877286741906053473080432991',
2/21/17 5:43:10.029 PM [APP/1-0] OUT driver: 'com.sap.db.jdbc.Driver',
2/21/17 5:43:10.029 PM [APP/1-0] OUT port: '39013',
2/21/17 5:43:10.029 PM [APP/1-0] OUT host: 'hxehost',
2/21/17 5:43:10.030 PM [APP/1-0] OUT db_hosts: [ [Object] ],
2/21/17 5:43:10.030 PM [APP/1-0] OUT hdi_user: 'SBSS_83334296438621582446875247756815583089206573744991685984656236358',
2/21/17 5:43:10.030 PM [APP/1-0] OUT user: 'SBSS_00037906215021896711021970862030700987826745093749121495645296774',
2/21/17 5:43:10.030 PM [APP/1-0] OUT url: 'jdbc:sap://hxehost:39013/?currentschema=HQ8PUPG1X3OVKLDK_VENDOR' } }
2/21/17 5:43:10.072 PM [APP/1-0] OUT Server listening on port 55001
<br>
0

What do you mean with "... if I use a specific schema ... "? Where do you use a specific schema?

0
Former Member
Florian Pfeffer

If I use the HQ8PUPG1X3OVKLDK_VENDOR current schema in the oData-service or the watson.nodedb namespace:

service  {
   "HQ8PUPG1X3OVKLDK_VENDOR"."vendormodel.Audit" as "Audit";
}


service {
         "watson.nodedb::vendormodel.Audit" as "MyTable";
}
0

This first definition is wrong. Do not use the generated schema name in your coding.

If the second one works, depends on your namespace settings (in .hdinamespace file).

0
Former Member
Florian Pfeffer

My namespace looks like this and I don't use a namespace in the hdbcds-file, only the context vendormodel and the Audit as Entity. I tried a lot of options, but I didn't found a version, that shows me the odata service.

{
    "name":    "",
    "subfolder": "ignore"
}

0
avatar image
Former Member Feb 25, 2017 at 02:45 PM
0

The mta.yaml file has an indent error and the namespace was wrong for my file-structure.

The OData-Service runs now for my application.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Lukas,

I've faced the same issue when I trying to call my OData service, and below is my mta.yaml file content:

ID: kck_todo_list
_schema-version: '2.0'
description: chengkun e2e project
version: 0.0.1


modules:
 - name: kck_todo_db
   type: nodejs
   path: kck_todo_db
   requires:
    - name: kck-hdi-container
      properties:
          TARGET_CONTAINER: ~{hdi-container-name}
   parameters:
      memory: 128M
      disk-quota: 128M


 - name: kck_todo_nodejs
   type: nodejs
   path: kck_todo_nodejs
   provides:
    - name: kck_todo_nodejs_api
      properties:
         url: ${default-url}
   requires:
    - name: kck-hdi-container
    - name: kck_todo_uaa
   parameters:
      memory: 128M
      disk-quota: 512M
      host: sap-cec-servecwdf-${space}-kck-todo-nodejs
   properties:
      TENANT_HOST_PATTERN: "^(.*)-servecwdf-${space}-kck-todo-nodejs.cfapps.sap.hana.ondemand.com"


 - name: kck_todo_ui
   type: html5
   path: kck_todo_ui
   requires:
      - name: kck_todo_nodejs_api
        group: destinations
        properties:
          url: ~{url}
          name: kck_todo_nodejs_api
          forwardAuthToken: true
      - name: kck_todo_uaa
   parameters:
      memory: 256M
      disk-quota: 256M
      host: sap-cec-servecwdf-${space}-kck-todo-ui
   properties:
      TENANT_HOST_PATTERN: "^(.*)-servecwdf-${space}-kck-todo-ui.cfapps.sap.hana.ondemand.com"


 - name: kck_todo_fiori
   type: html5
   path: kck_todo_fiori
   requires:
    - name: kck_todo_nodejs_api
      group: destinations
      properties:
         name: kck_todo_nodejs_api
         url: ~{url}
         forwardAuthToken: true
    - name: kck_todo_uaa
   parameters:
      memory: 256M
      disk-quota: 512M
      host: sap-cec-servecwdf-${space}-kck-todo-fiori
   properties:
      TENANT_HOST_PATTERN: "^(.*)-servecwdf-${space}-kck-todo-fiori.cfapps.sap.hana.ondemand.com"


resources:
 - name: kck-hdi-container
   type: com.sap.xs.hdi-container
   properties:
      hdi-container-name: ${service-name}
   parameters:
      service: managed-hana
      service-plan: hdi-shared
 - name: kck_todo_uaa
   type: com.sap.xs.uaa
   parameters:
      service: xsuaa
      service-plan: default

Error returned from service:

returning status 500: Invalid HANA settings provided. OData services are disabled.#
2017-09-21T13:45:27.15+0800 [APP/PROC/WEB/0] ERR     at Layer.handle [as handle_request] (/home/vcap/app/node_modules/express/lib/router/layer.js:95:5)
2017-09-21T13:45:27.15+0800 [APP/PROC/WEB/0] ERR     at urlRewriteMiddleware (/home/vcap/app/node_modules/@sap/xsjs/lib/middleware.js:54:5)
2017-09-21T13:45:27.15+0800 [APP/PROC/WEB/0] ERR     at trim_prefix (/home/vcap/app/node_modules/express/lib/router/index.js:317:13)
2017-09-21T13:45:27.15+0800 [APP/PROC/WEB/0] ERR     at /home/vcap/app/node_modules/express/lib/router/index.js:284:7
2017-09-21T13:45:27.15+0800 [APP/PROC/WEB/0] ERR Error: Invalid HANA settings provided. OData services are disabled.
2017-09-21T13:45:27.15+0800 [APP/PROC/WEB/0] ERR     at trim_prefix (/home/vcap/app/node_modules/express/lib/router/index.js:317:13)
2017-09-21T13:45:27.15+0800 [APP/PROC/WEB/0] ERR     at next (/home/vcap/app/node_modules/express/lib/router/index.js:275:10)
2017-09-21T13:45:27.15+0800 [APP/PROC/WEB/0] ERR     at /home/vcap/app/node_modules/express/lib/router/index.js:284:7

Do you have any idea for it?

Thanks

Chengkun

0