on 2020 Aug 10 9:03 AM
Hi, in an attempt to learn about the authentication and authorisation in CAP apps on Cloud Foundry I have been using this documentation https://cap.cloud.sap/docs/node.js/authentication.
In summary, I have run through the https://cap.cloud.sap/docs/get-started/in-a-nutshell guide in the CAP documentation, followed by the "Token-Based Authentication (JWT)" section in the authentication documentation I linked to above, all the way through to the final step just before the "Custom Authentication Middleware" section.
When I am running my CAP service to test it, in an incognito window, I am made to log in as expected, but then when I try and access my Admin service which is protected by the admin role I receive the following error.
GET /admin/Authors
[2020-08-10T07:47:48.189Z | ERROR | 1431319]: SQLITE_ERROR: no such table: localized_AdminService_Authors
[2020-08-10T07:47:48.189Z | ERROR | 1431319]: Error stacktrace: Error: SQLITE_ERROR: no such table: localized_AdminService_Authors
I have tried a few things I found in other answers which sounded similar however none of those have worked. Any help would be much appreciated. I have included file I think may be relevant below.
package.json
{
"name": "authtest",
"version": "1.0.0",
"description": "A simple CAP project.",
"repository": "<Add your repository here>",
"license": "UNLICENSED",
"private": true,
"dependencies": {
"@sap/audit-logging": "^3.1.1",
"@sap/cds": "^4.1.5",
"@sap/xsenv": "^3.0.0",
"@sap/xssec": "^2.2.5",
"express": "^4",
"passport": "^0.4.1"
},
"devDependencies": {
"sqlite3": "^4.2.0"
},
"scripts": {
"start": "npx cds run"
},
"cds": {
"hana": {
"deploy-format": "hdbtable"
},
"requires": {
"db": {
"kind": "sql"
},
"auth": {
"strategy": "JWT"
},
"uaa": {
"kind": "xsuaa"
}
}
}
}
xs-app.json
{
"routes": [ {
"source": "^/(.*)",
"destination": "srv_api"
} ]
}
admin-service.cds
using { sap.capire.bookshop as my } from '../db/schema';
service AdminService @(requires:'admin') {
entity Books as projection on my.Books;
entity Authors as projection on my.Authors;
}
Hi John,
I've encountered the same issue after updating my schema.
To solve it, I've recreate/redeploy to the SQLite dev. Other script was inserted in package.json
{
...,
"scripts": {
"start": "npx cds run",
"dev":"npx cds watch",
"dev:db-sync": "cds deploy --to sqlite:raprincis.db",
"dev:db-deploy": "npx sqlite3 raprincis.db .dump && sqlite3 raprincis.db .tables",
"dev:db": "npm run dev:db-sync && npm run dev:db-deploy"
},
"cds": {
"requires": {
"db": {
"kind": "sqlite",
"credentials": {
"database": "raprincis.db"
}
}
}
}
}
And at the end I run:
npm run dev:db
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
11 | |
10 | |
10 | |
9 | |
9 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.