cancel
Showing results for 
Search instead for 
Did you mean: 

ERROR: Executing a view with parameters with CAP september 2020 release

luisgleon
Participant
0 Kudos

Hi everybody,

I´m getting this error when i execute a view with parameters in CAP, this was fine before CAP september 2020 release. This is the error:

GET /bacrcr003/CatalogoCaracteristica(codigoMarca='',codigoModelo='',annoModelo='',caracteristica='SCP_MARCA')/Set
[2020-10-22T01:12:54.548Z | ERROR | 1642953]: name.replace is not a function
[2020-10-22T01:12:54.549Z | ERROR | 1642953]: Error stacktrace: TypeError: name.replace is not a function     at ensureNoDraftsSuffix (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds-runtime/lib/common/utils/draft.js:35:43)     at getEntityFromCQN (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds-runtime/lib/common/utils/entityFromCqn.js:40:30)     at HanaDatabase.transformToArrayed [as _arrayed] (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds-runtime/lib/db/generic/arrayed.js:43:18)     at /Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds/lib/srv/Service.js:102:54     at Array.map (<anonymous>)     at HanaDatabase.dispatch (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds/lib/srv/Service.js:102:28)     at async ApplicationService.<anonymous> (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds-runtime/lib/common/generic/crud.js:43:16)     at async next (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds/lib/srv/Service.js:90:34)     at async ApplicationService.dispatch (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds/lib/srv/Service.js:86:26)     at async _readCollectionNoCount (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds-runtime/lib/cds-services/adapter/odata-v4/handlers/read.js:261:18)
[INTERNAL ERROR] TypeError: name.replace is not a function
    at ensureNoDraftsSuffix (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds-runtime/lib/common/utils/draft.js:35:43)
    at getEntityFromCQN (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds-runtime/lib/common/utils/entityFromCqn.js:40:30)
    at HanaDatabase.transformToArrayed [as _arrayed] (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds-runtime/lib/db/generic/arrayed.js:43:18)
    at /Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds/lib/srv/Service.js:102:54
    at Array.map (<anonymous>)
    at HanaDatabase.dispatch (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds/lib/srv/Service.js:102:28)
    at async ApplicationService.<anonymous> (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds-runtime/lib/common/generic/crud.js:43:16)
    at async next (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds/lib/srv/Service.js:90:34)
    at async ApplicationService.dispatch (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds/lib/srv/Service.js:86:26)
    at async _readCollectionNoCount (/Users/luisgleon/Downloads/Development/ZAPATA/dms4100-bacrcr003/node_modules/@sap/cds-runtime/lib/cds-services/adapter/odata-v4/handlers/read.js:261:18)
Please report this error.

my package.json libraries:

    "@sap/cds": "4.2.4",
    "@sap/cds-odata-v2-adapter-proxy": "1.4.49",
    "@sap/cds-runtime": "2.5.5",
    "@sap/cloud-sdk-core": "1.17.2",
    "@sap/hana-client": "2.6.58",
    "@sap/xsenv": "3.0.0",
    "@sap/xssec": "3.0.10",

I had to dowgrade this two packages to make it work again:

"@sap/cds": "4.1.9",
"@sap/cds-runtime": "2.3.1",

Finally, this is my view in cds file.

    view CatalogoCaracteristica(codigoMarca : String, codigoModelo : String, annoModelo : String, caracteristica : String) as
        select from Caracteristicas
        left join Alternativas
            on Caracteristicas.ID = caracteristica.ID
        {
            key Alternativas.ID,
                marca,
                modelo,
                anno,
                codigo,
                valor,
                Alternativas.descripcion
        }
        where
                marca  = : codigoMarca
            and modelo = : codigoModelo
            and anno   = : annoModelo
            and codigo = : caracteristica
        order by
            valor asc;

Thanks in advance.

OlenaT
Advisor
Advisor

Hi Luis,

Thank you for reporting the issue! It's a known problem, we will get back to you as soon as the fix will be available.

Best regards,

Olena

Accepted Solutions (1)

Accepted Solutions (1)

heiko_witteborg
Explorer

Hi Luis,

the fix for this problem was released. Of course please let us know if you still face issues.

Best regards,

Heiko

luisgleon
Participant
0 Kudos

Hi Heiko,

Thanks, it works ok. I have this library versions:

    "@sap/cds": "4.3.0",
    "@sap/cds-odata-v2-adapter-proxy": "1.4.54",
    "@sap/cds-runtime": "2.6.3",
    "@sap/cloud-sdk-core": "1.17.2",
    "@sap/hana-client": "2.6.61",
    "@sap/xsenv": "3.1.0",
    "@sap/xssec": "3.0.10",

Best regards

Answers (1)

Answers (1)

MarcelloUrbani
Active Contributor
0 Kudos

still having the same issue with cds-pg and the latest engine

vobu
Active Contributor

that's most certainly because we haven't yet upgdated cds-pg to support cds^6
please try downgrading cds to cds^5

→ talks are on the way with the CAP core team on how to best co-maintain cds-pg in the future

MarcelloUrbani
Active Contributor
0 Kudos

Thank you

Looks like the original issue is that cds-routing-handlers is not compatible with 6.x

More precisely, it works but if you throw an exception it dies, if I remember correctly with a similar error. Happens without postgres interactions too.

Will open an issue there now that I think about it, but will stay on 5.x for the time being