capnp-ts icon indicating copy to clipboard operation
capnp-ts copied to clipboard

Addressbook js example has errors.

Open LiamKarlMitchell opened this issue 5 years ago • 2 comments

Node.js v12.2.0

node addressbook write | node addressbook read

(node:51772) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Error: CAPNP-TS023 Cannot convert Pointer_0@0x00000028,[21 00 00 00 3f 00 00 00],limit:0x7ffffffc to a BYTE list.
    at Object.validate (D:\Source\capnp-ts-master\packages\js-examples\node_modules\capnp-ts\lib\serialization\pointers\pointer.js:695:19)
    at Function.Text.fromPointer (D:\Source\capnp-ts-master\packages\js-examples\node_modules\capnp-ts\lib\serialization\pointers\text.js:21:19)
    at Function.getText (D:\Source\capnp-ts-master\packages\js-examples\node_modules\capnp-ts\lib\serialization\pointers\struct.js:478:25)
    at Person.getEmail (D:\Source\capnp-ts-master\packages\js-examples\addressbook.capnp.js:70:43)
    at D:\Source\capnp-ts-master\packages\js-examples\addressbook.js:94:52
    at class_1.List.forEach (D:\Source\capnp-ts-master\packages\js-examples\node_modules\capnp-ts\lib\serialization\pointers\list.js:121:13)
    at D:\Source\capnp-ts-master\packages\js-examples\addressbook.js:93:29
    at processTicksAndRejections (internal/process/task_queues.js:89:5)

LiamKarlMitchell avatar May 11 '19 04:05 LiamKarlMitchell

Even using Buffer.from still get an error when reading.

Error: CAPNP-TS023 Cannot convert Pointer_0@0x00000028,[21 00 00 00 3f 00 00 00],limit:0x7ffffffc to a BYTE list.
    at Object.validate (D:\Source\capnp-ts-master\packages\js-examples\node_modules\capnp-ts\lib\serialization\pointers\pointer.js:695:19)
    at Function.Text.fromPointer (D:\Source\capnp-ts-master\packages\js-examples\node_modules\capnp-ts\lib\serialization\pointers\text.js:21:19)
    at Function.getText (D:\Source\capnp-ts-master\packages\js-examples\node_modules\capnp-ts\lib\serialization\pointers\struct.js:478:25)
    at Person.getEmail (D:\Source\capnp-ts-master\packages\js-examples\addressbook.capnp.js:70:43)
    at D:\Source\capnp-ts-master\packages\js-examples\addressbook.js:94:52
    at class_1.List.forEach (D:\Source\capnp-ts-master\packages\js-examples\node_modules\capnp-ts\lib\serialization\pointers\list.js:121:13)
    at D:\Source\capnp-ts-master\packages\js-examples\addressbook.js:93:29
    at processTicksAndRejections (internal/process/task_queues.js:89:5)

LiamKarlMitchell avatar May 11 '19 04:05 LiamKarlMitchell

I got the same issue with fs stream. But when I use socket.io the issue disappeared. The demo works under socket.io env

ptrjeffrey avatar May 18 '21 04:05 ptrjeffrey