cds2types icon indicating copy to clipboard operation
cds2types copied to clipboard

Command failed: npx cds2types

Open gabriel-inf opened this issue 2 years ago • 1 comments

Hi!

I'm trying to compose a view for a select that should aggregate values using group by and sum. I'm able to create the view executing cds deploy but when running npx cds2types --cds file.cds --output output.ts -f to create the types I get the following error:


view ViewA as
  select from TableA as ta
  inner join Tableb as tb
    on tb.id = ta.tableBId
  {
    ta.field1 as field1,
+  sum(tb.field2) as field2
  }
  where
    <conditions>
  group by
    ta.field1;

if I don't use sum, it works well,

Error: Command failed: npx cds2types --cds file.cds --output output.ts -f
    at checkExecSyncError (child_process.js:790:11)
    at execSync (child_process.js:863:15)
    at Object.<anonymous> (~/scripts/convert-entities-to-ts.js:21:3)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47 {
  status: 255,
  signal: null,
  output: [
    null,
    Buffer(93) [Uint8Array] [
       85, 110,  97,  98, 108, 101,  32, 116, 111,  32, 119, 114,
      105, 116, 101,  32, 116, 121, 112, 101, 115,  46,  32,  80,
      108, 101,  97, 115, 101,  32, 117, 115, 101,  32, 116, 104,
      101,  32, 100, 101,  98, 117, 103,  32, 102, 108,  97, 103,
       32,  40,  45, 100,  44,  32,  45,  45, 100, 101,  98, 117,
      103,  41,  32, 102, 111, 114,  32,  97,  32, 100, 101, 116,
       97, 105, 108, 101, 100,  32, 101, 114, 114, 111, 114,  32,
      109, 101, 115, 115,  97, 103, 101,  46,  10
    ],
    Buffer(0) [Uint8Array] []
  ],
  pid: 62610,
  stdout: Buffer(93) [Uint8Array] [
     85, 110,  97,  98, 108, 101,  32, 116, 111,  32, 119, 114,
    105, 116, 101,  32, 116, 121, 112, 101, 115,  46,  32,  80,
    108, 101,  97, 115, 101,  32, 117, 115, 101,  32, 116, 104,
    101,  32, 100, 101,  98, 117, 103,  32, 102, 108,  97, 103,
     32,  40,  45, 100,  44,  32,  45,  45, 100, 101,  98, 117,
    103,  41,  32, 102, 111, 114,  32,  97,  32, 100, 101, 116,
     97, 105, 108, 101, 100,  32, 101, 114, 114, 111, 114,  32,
    109, 101, 115, 115,  97, 103, 101,  46,  10
  ],
  stderr: Buffer(0) [Uint8Array] []
}

Does anyone ever faced this issue or has any clue on how to fix it? Thank you!

gabriel-inf avatar Jun 01 '22 22:06 gabriel-inf

Hi @gabriel-inf,

We'll look into this one. Thanks for reporting.

Kind regards Johannes

thisisevanfox avatar Nov 09 '22 11:11 thisisevanfox