Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Server Error after deployed to HANA DB #1020

Open
iadc2005 opened this issue Apr 26, 2024 · 9 comments
Open

Internal Server Error after deployed to HANA DB #1020

iadc2005 opened this issue Apr 26, 2024 · 9 comments

Comments

@iadc2005
Copy link

dear experts, I tried many times but still have no clue why there is an internal server error issue as screenshot shows.
Screenshot 2024-04-26 at 16 51 09
Once I click "Go" (sorry for Chinese) and the error will come.
The same will come if I click "Create".
I already granted myself the required roles.

@iadc2005
Copy link
Author

iadc2005 commented Apr 26, 2024

I tried to ask ChatGPT and here is the reply for my logs(I have this table in my HANA DB and don't know why it will call draft table just for a simple Travel "GET" call):

This error message is similar to the previous one you posted. It indicates that there is an issue with the SQL query being executed. The database is unable to recognize the column name ALIAS_1.DRAFTADMINISTRATIVEDATA.INPROCESSBYUSER.

Here are some steps to troubleshoot this issue:

  1. Check the SQL Query: Ensure that the SQL query is written correctly. Make sure that the column ALIAS_1.DRAFTADMINISTRATIVEDATA.INPROCESSBYUSER exists in the TravelService_Travel_drafts table. If the column doesn't exist, you will need to correct the SQL query.

  2. Check the Table Structure: Make sure that the table TravelService_Travel_drafts has the column DRAFTADMINISTRATIVEDATA.INPROCESSBYUSER. If the column doesn't exist, you will need to add it to the table or modify your SQL query to remove references to it.

  3. Check the Database Schema: Ensure that the database schema is up-to-date and matches the schema expected by your application. If the schema is out of date, you may need to update it.

  4. Check the Application Code: If the SQL query is being generated by your application code, there may be a bug in the code that is causing the incorrect query to be generated. Check the code to make sure it is correctly generating the SQL query.

If you're still having trouble after trying these steps, you may need to seek help from a database administrator or a developer familiar with the database and application.

@iadc2005
Copy link
Author

iadc2005 commented Jun 5, 2024

Anyone here?

@floliver
Copy link

UP ?

@gregorwolf
Copy link
Contributor

Hi @iadc2005,

it would help if you provide more details. Also maybe your issue is already solved?

@floliver
Copy link

I do have the same issue on my project (not the sflight) with the following dependencies :

"dependencies": {
	"@cap-js/hana": "^1.5.2",
	"@sap-cloud-sdk/connectivity": "^3.8.1",
	"@sap-cloud-sdk/http-client": "^3.8.1",
	"@sap-cloud-sdk/resilience": "^3.8.1",
	"@sap/cds-hana": "^2",
	"@sap/cds-mtxs": "^2",
	"@sap/xssec": "^4",
	"express": "^4",
	"passport": "^0.7.0"
},
"devDependencies": {
	"@cap-js/cds-typer": "^0.32.1",
	"@cap-js/cds-types": "^0.9.0",
	"@cap-js/sqlite": "^1.7.3",
	"@eslint/js": "^9.9.0",
	"@jest/globals": "^29.7.0",
	"@sap/cds": "^8.6.1",
	"@sap/cds-dk": "^8.6.1",
	"@sap/eslint-plugin-cds": "^3.0.4",
	"@sap/hdi-deploy": "^5",
	"@sap/ux-specification": "^1.120.14",
	"@tsconfig/node-lts": "^20",
	"@types/chai": "^4.3.16",
	"@types/chai-as-promised": "^7.1.8",
	"@types/chai-subset": "^1.3.5",
	"@types/eslint__js": "^8.42.3",
	"@types/jest": "^29.5.14",
	"@types/mocha": "^10.0.10",
	"@types/node": "^22.0.0",
	"chai": "^4.5.0",
	"chai-as-promised": "^7.1.2",
	"chai-subset": "^1.6.0",
	"eslint": "^9.9.0",
	"eslint-plugin-jest": "^28.8.0",
	"jest": "^29.7.0",
	"prettier": "3.3.3",
	"rimraf": "^6.0.1",
	"ts-jest": "^29.2.4",
	"ts-node": "^10.9.2",
	"typescript": "^5.5.4",
	"typescript-eslint": "^8.1.0"
},

The query generated looks wrong bc the draft inprocessbyuser column is not in the draft table of the entity but in a dedicated table and the link is made with a UUID

@ziyang-works
Copy link

ziyang-works commented Jan 24, 2025

I'm getting the similar error message when running a simple CAP Java + Fiori Element app with HANA Cloud in hybrid mode:

invalid column name: DRAFTADMINISTRATIVEDATA.INPROCESSBYUSER: line 1 col 156 (at pos 155)

The error appears when I click on "Go" in this List Report page:

Image

Log from CAP:

[cds] - [SqlError: invalid column name: DRAFTADMINISTRATIVEDATA.INPROCESSBYUSER: line 1 col 156 (at pos 155)] {
  code: 260,
  sqlState: 'HY000',
  level: 1,
  position: 0,
  query: `SELECT HasActiveEntity AS "HasActiveEntity", ID AS "ID", parent_ID AS "parent_ID", type AS "type" FROM EventTemplateService_TreeNodes_drafts ALIAS_1 WHERE DraftAdministrativeData.InProcessByUser = ? ORDER BY ID ASC  with parameters ('LOCALE' = 'en')`,
  values: [ 'admin' ]
}
[error] - 500 > {
  message: 'invalid column name: DRAFTADMINISTRATIVEDATA.INPROCESSBYUSER: line 1 col 156 (at pos 155)',
  code: '260'
}

@ziyang-works
Copy link

ziyang-works commented Jan 24, 2025

I'm getting the similar error message when running a simple CAP Java + Fiori Element app with HANA Cloud in hybrid mode:

invalid column name: DRAFTADMINISTRATIVEDATA.INPROCESSBYUSER: line 1 col 156 (at pos 155)

The error DRAFTADMINISTRATIVEDATA.INPROCESSBYUSER is gone after I did the following steps. I don't know which one worked, but there must be something missing from the cap documentation or cds CLI.

  1. In project root -> package.json, add this dependency manually:
     "@cap-js/hana": "^x"
    I wonder why it's not added when running cds add hana --for hybrid.
  2. Install dependency with npm i
  3. Restart app (I also redeployed db, but probably irrelevant)
    cds watch --profile hybrid

@floliver
Copy link

floliver commented Jan 25, 2025

Weird I already have this dependency and still get this error. Could you share your complete package json @ziyang-works ?

@gregorwolf As info, I got this error since the multitenancy and here is my package json :

"dependencies": {
"@cap-js/hana": "^1.5.2",
"@sap/cds": "^8.6.1",
"@sap/cds-mtxs": "^2.4.2",
"@sap/hdi-deploy": "^5",
"@sap/xsenv": "^5.4.0",
"@sap/xssec": "^4.2.8",
"express": "^4.21.2"
},
"devDependencies": {
"@cap-js/sqlite": "^1.7.8"
},

@floliver
Copy link

I believe i found the issue. At least it has worked on my side.

I've removed the @sap/cds-hana dependency and added the hdi-deploy dependency to the mtx package.json.

Please note that a unsubscribe is then needed in order to retrigger to deploy of the DB properly. Without this unsubscribe it may not work ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants