question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@sap-cloud-sdk/generator: Cannot find name 'ElectronicDocProtocolCodeStrEnum'.

See original GitHub issue

I try to generate a custom SAP Cloud SDK OData based on the Metadata from the SAP Business One Service Layer. My sample project is provided here: sap-business-one-odata-cap branch real-b1-metadata.

Steps to reproduce the behavior:

  1. Clone the above repository
  2. run npm i
  3. run npm run generate-odata-client
  4. After about 10 minutes you get this error:
[2021-07-13T05:54:10.674Z] ERROR    (generator-cli): ErrorWithCause: Generation of services failed.
    at new ErrorWithCause (/Users/gwolf/Documents/Projects/cap/sap-business-one-odata-cap/node_modules/@sap-cloud-sdk/util/dist/error-with-cause.js:32:16)
    at /Users/gwolf/Documents/Projects/cap/sap-business-one-odata-cap/node_modules/@sap-cloud-sdk/generator/dist/generator-cli.js:33:18
Caused by:
Error: Compilation Errors:
/Users/gwolf/Documents/Projects/cap/sap-business-one-odata-cap/srv/odata-client/sapb-1-service/ElectronicDocumentsRequestBuilder.ts:3:502 - error TS2304: Cannot find name 'ElectronicDocProtocolCodeStrEnum'.
/Users/gwolf/Documents/Projects/cap/sap-business-one-odata-cap/srv/odata-client/sapb-1-service/ElectronicDocumentsRequestBuilder.ts:3:502 - error TS4073: Parameter 'code' of public method from exported class has or is using private name 'ElectronicDocProtocolCodeStrEnum'.
/Users/gwolf/Documents/Projects/cap/sap-business-one-odata-cap/srv/odata-client/sapb-1-service/ElectronicDocumentsRequestBuilder.ts:3:2072 - error TS2304: Cannot find name 'ElectronicDocProtocolCodeStrEnum'.
/Users/gwolf/Documents/Projects/cap/sap-business-one-odata-cap/srv/odata-client/sapb-1-service/ElectronicDocumentsRequestBuilder.ts:3:2072 - error TS4073: Parameter 'code' of public method from exported class has or is using private name 'ElectronicDocProtocolCodeStrEnum'.
/Users/gwolf/Documents/Projects/cap/sap-business-one-odata-cap/srv/odata-client/sapb-1-service/ElectronicDocumentsRequestBuilder.ts:3:502 - error TS4073: Parameter 'code' of public method from exported class has or is using private name 'ElectronicDocProtocolCodeStrEnum'.
/Users/gwolf/Documents/Projects/cap/sap-business-one-odata-cap/srv/odata-client/sapb-1-service/ElectronicDocumentsRequestBuilder.ts:3:2072 - error TS4073: Parameter 'code' of public method from exported class has or is using private name 'ElectronicDocProtocolCodeStrEnum'.
    at Object.<anonymous> (/Users/gwolf/Documents/Projects/cap/sap-business-one-odata-cap/node_modules/@sap-cloud-sdk/generator-common/dist/compiler.js:69:31)
    at step (/Users/gwolf/Documents/Projects/cap/sap-business-one-odata-cap/node_modules/@sap-cloud-sdk/generator-common/dist/compiler.js:33:23)
    at Object.next (/Users/gwolf/Documents/Projects/cap/sap-business-one-odata-cap/node_modules/@sap-cloud-sdk/generator-common/dist/compiler.js:14:53)
    at fulfilled (/Users/gwolf/Documents/Projects/cap/sap-business-one-odata-cap/node_modules/@sap-cloud-sdk/generator-common/dist/compiler.js:5:58)

Is this an issue with the @sap-cloud-sdk/generator or should we file an incident via SAP Support for SAP Business One as their Metadata may be incorrect?

Best regards Gregor

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jjtang1985commented, Jul 13, 2021

Hi @gregorwolf ,

thanks for the heads-up.

The root cause is that this metadata file is use enum as a key of some entities, which is not supported in the SDK. I’ll create a backlog item for it.

As you mentioned, this is a sample app, I would mark it as medium priority.

Best regards, Junjie

0reactions
jjtang1985commented, Aug 2, 2021

@gregorwolf ,

the fix has been merged and is available if you try the canary version. We’ll release a stable version hopefully in this week.

I’ll close this ticket, please reopen if you have questions.

Best regards, Junjie

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript getting error TS2304: cannot find name ' require'
I am getting the error "TS2304: Cannot find name 'require' " when I attempt to transpile a simple TypeScript Node.js page. I have...
Read more >
Cannot find name 'DedicatedGatewayRequestOptions' #22003
I am trying to use @azure/cosmos inside an Azure Function written in typescript. When I try to npm run build , the build...
Read more >
Typescript Angular Cannot find name [closed]
I am working on Aspnet Core Angular project and getting following error: TS2304: Cannot find name 'email'. The code is executed in visual...
Read more >
TypeScript error TS2304 cannot find name require - Edureka
The error that I'm getting is the "TS2304: Cannot find name 'require' " when I attempt to transpile a simple TypeScript Node.js page....
Read more >
NodeJS SDK: While using Localhost mode, error generated
NodeJS SDK: While using Localhost mode, error generated: Cannot find name 'path' · Issue. Using Node.js SDK, when trying to run the code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found