Comments (16)
Do you get this error also when running pg-beershop locally instead of your own project?
from cds-pg.
@TNFlexso Can you try the below config? Works fine for me.
"dependencies": {
"@sap/cds": "5.8.4",
"cds-dbm": "~0.0.36",
"cds-pg": "0.1.26",
"express": "^4",
"@sap/cds-odata-v2-adapter-proxy":"*"
},
"cds": {
"requires": {
"db": {
"kind": "database"
},
"database": {
"dialect": "plain",
"impl": "cds-pg",
"model": [
"models",
"services"
],
"credentials": {
}
}
}
}
from cds-pg.
Hi I have this same issue, any ideas on how to solve it?
from cds-pg.
Hi @binpath
please provide details about your environment and how to reproduce the issue.
CU
Gregor
from cds-pg.
Hi @gregorwolf,
DB
My database is in a docker version 14.1
`version: '3.8'
services:
db:
image: postgres:14.1-alpine
volumes:
- db_data:/var/postgresql/data
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 1234
PGDATA: /var/lib/postgresql/data/pgdata
adminer:
image: adminer
restart: always
ports:
- 8080:8080
volumes:
db_data:`
Then I ran docker_compose up
connect to adminer and create the database manually
CAP
The CAP project is in another docker
`ARG VARIANT="16-buster"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:${VARIANT}
WORKDIR /code
RUN wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | apt-key add - ;
echo "deb https://packages.cloudfoundry.org/debian stable main" | tee /etc/apt/sources.list.d/cloudfoundry-cli.list
RUN apt-get update
&& apt-get -y install --no-install-recommends cf7-cli sqlite openjdk-11-jre
COPY . .
RUN su node -c "npm install -g @ui5/cli @sap/cds-dk yo generator-easy-ui5 hana-cli"`
I create the image docker build and run it later in the same network
docker run --rm -it --name dev --net=dev_default -p 4004:4004 -v $(pwd):/code binpath/dev:1.0 /bin/bash
Environment
root ➜ /code $ cds --version
@sap/cds: 5.1.5
@sap/cds-compiler: 2.13.8
@sap/cds-dk: 4.9.2
@sap/cds-foss: 2.3.1
@sap/cds-runtime: 3.1.2
Node.js: v16.14.0
home: /code/node_modules/@sap/cds
I deploy
npx cds-dbm deploy
Finally, I start the enviroment
npm start
I select my entity
[INTERNAL ERROR] TypeError: Cannot read properties of undefined (reading 'regularRegex') at smartId (/code/node_modules/@sap/cds-compiler/lib/sql-identifier.js:66:9) at _smartId (/code/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/common/utils/quotingStyles.js:19:23) at PGReferenceBuilder.plain [as _quoteElement] (/code/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/common/utils/quotingStyles.js:46:12) at /code/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/ReferenceBuilder.js:106:49 at Array.map (<anonymous>) at PGReferenceBuilder._parseReference (/code/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/ReferenceBuilder.js:106:34) at PGReferenceBuilder.build (/code/node_modules/cds-pg/lib/pg/sql-builder/ReferenceBuilder.js:44:52) at PGSelectBuilder._buildRefElement (/code/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/SelectBuilder.js:272:68) at PGSelectBuilder._buildElement (/code/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/SelectBuilder.js:246:18) at /code/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/SelectBuilder.js:311:56
Thanks
from cds-pg.
Hi @binpath,
do you have your project in a public Git repo? Have you tried with pg-beershop?
CU
Gregor
from cds-pg.
Hi @gregorwolf no is just a simple cds init, with a Base entity.
from cds-pg.
Plese try
...
"requires": {
"db": {
"kind": "postgres",
"dialect": "plain"
},
from cds-pg.
Update: The problem seems to be the a sap/cds version higher then 5.9.8. Now my problem is solved
I got the same issue. here is my public repo: Repo
[cds] - GET /catalog/Parties [cds] - TypeError: Cannot read properties of undefined (reading 'regularRegex') at smartId (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds-compiler/lib/sql-identifier.js:66:9) at _smartId (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/common/utils/quotingStyles.js:19:23) at PGReferenceBuilder.plain [as _quoteElement] (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/common/utils/quotingStyles.js:46:12) at /Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/ReferenceBuilder.js:106:49 at Array.map (<anonymous>) at PGReferenceBuilder._parseReference (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/ReferenceBuilder.js:106:34) at PGReferenceBuilder.build (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/lib/pg/sql-builder/ReferenceBuilder.js:44:52) at PGSelectBuilder._buildRefElement (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/SelectBuilder.js:272:68) at PGSelectBuilder._buildElement (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/SelectBuilder.js:246:18) at /Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/SelectBuilder.js:311:56 { id: '1643917', level: 'ERROR', timestamp: 1661772351579 } [INTERNAL ERROR] TypeError: Cannot read properties of undefined (reading 'regularRegex') at smartId (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds-compiler/lib/sql-identifier.js:66:9) at _smartId (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/common/utils/quotingStyles.js:19:23) at PGReferenceBuilder.plain [as _quoteElement] (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/common/utils/quotingStyles.js:46:12) at /Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/ReferenceBuilder.js:106:49 at Array.map (<anonymous>) at PGReferenceBuilder._parseReference (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/ReferenceBuilder.js:106:34) at PGReferenceBuilder.build (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/lib/pg/sql-builder/ReferenceBuilder.js:44:52) at PGSelectBuilder._buildRefElement (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/SelectBuilder.js:272:68) at PGSelectBuilder._buildElement (/Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/SelectBuilder.js:246:18) at /Users/A3886136/Documents/VSCode/tdao_parties/node_modules/cds-pg/node_modules/@sap/cds/libx/_runtime/db/sql-builder/SelectBuilder.js:311:56
For me the service is crashing when i try to open my data on the service... $catalog & $metadata are opening
from cds-pg.
Correct CAP 6 is not yet supported.
from cds-pg.
Hi,
I followed the documentation on the README and after 1/2 hour debugging I recognized it's bundled with this issue.
Finally @octavonu approach will solve it.
It's not clear to me if this is the solution or a workaround in your point of view.
Hint for theerror detechtion / solution:
-
if @octavonu approach will should be the solution - then please correct it in the README
-
if the configuration should be as the documented in the README, then the configuration will not correct filled for processing in cds serve
The error will raise in the function smartID of cds application (see above error message) - not in the pg driver.
But I guess the pg-driver does not intialize the configuration correctly.
Due to a || construct in function smartID of cds the database configuration name will be taken, not the dialect, the dialect is not filled with the config item.
In other words, if you name the configuration "plain" instead of "postgres" it will work as well, due in smartID it's an || withe the dialect (But I am pretty sure, this was not the design goal).
Sorry, but I didn't have the nerve to find out, where the dialect hast to be filled in the driver initialization, if the configuration should being approached as in the README.md.
Anyway, hope it'll help a little bit.
Regards
from cds-pg.
Correct CAP 6 is not yet supported.
Do you have a prediction of when this will happen?
from cds-pg.
we're meeting with the CAP core team tomorrow evening CEST to discuss how to best jointly move forward.
we'll check back in on this gh repo's discussions or similar.
from cds-pg.
from cds-pg.
it got postponed to today, 14:30 CEST. i'll check ping back afterwards to
from cds-pg.
While the test suite is running without issue, manual tests to query against the database are failing.
It seems to be related to the code shown below where the dialect is not being set. Adding "dialect": "plain"
to the cds.requires.db
seems to solve the problem.
The automated testing uses the _runLocal.js
to set these properties. This is likely the reason why the tests are are successful.
const dbProperties = {
kind: 'postgres',
dialect: 'plain',
model: model,
credentials: credentials,
}
deployDB ? await cds.deploy(model, {}).to(dbProperties) : null
cds.db = await cds.connect.to(dbProperties)
Comparing the as-pg-packages.json
has the following.
{
"cds": {
"requires": {
"db": {
"kind": "database"
},
"database": {
"dialect": "plain",
"impl": "../../../",
"model": ["srv"]
}
}
}
}
Dialect is not maintained at the db
level. Adding "dialect": "plain"
resolves the problem caused by the quotingStyles.js
.
module.exports = {
plain: s => {
// set _dialect and _reserved once cds.db.kind is set
if (!_dialect && cds.db && cds.db.kind) {
_dialect = cds.db.options.dialect || cds.db.kind
}
So far, manual testing seems to be successful.
from cds-pg.
Related Issues (20)
- Invalid SQL query when Draft Entity make reference to other Draft Entity in OData call. HOT 3
- Vulnerability in momentjs 2.9.1 HOT 3
- Error upon modifying view in service HOT 1
- Strong security issue regarding indirect dependency to jsonwebtoken npm-module 8.x
- PATCH is executed on active entity for drafts with compositions HOT 3
- Error: [cds-dbm] - failed to load model undefined (STDERR, APP/TASK/deploy-to-postgresql)# HOT 2
- TypeError: Cannot read properties of undefined (reading 'definitions') HOT 4
- connection closed after each query
- Date conversion interprets timezone incorrectly
- Get request on entity not working
- Retain Column Name as case sensitive during deployment
- Wrong type cast of boolean HOT 1
- Query draft entities on db layer
- broken connectivity in 0.1.36 when using "cds watch" instead of "cds serve". using cap cds 6.6
- error: relation "[tablename]" does not exist
- duplicate key entry HOT 2
- cds-pg deploy fails with "Cannot find module '@sap/cds/lib/deploy'"
- Initial Release schedule?
- ERROR: syntax error at or near "LOCK" at character - STATEMENT: SELECT 1 FROM My_Type ALIAS_1 WHERE ( code = 1 ) LIMIT 1 FOR SHARE LOCK
- Query values must be an array ERROR
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cds-pg.