mrasu / echoed

Observable Integration Testing using OpenTelemetry on top of Jest/Playwright/Cypress.
MIT License
23 stars 0 forks source link

Error: illegal buffer on receiving trace from app (during test) #4

Closed meastp closed 1 month ago

meastp commented 1 month ago

I'm currently evaluating Echoed for testing in cypress and visualizing traces.

However, I get no traces and the following is logged to the console:

cypress-1  | Error: illegal buffer
cypress-1  |     at create_typed_array (/tests/node_modules/protobufjs/src/reader.js:47:15)
cypress-1  |     at create_buffer (/tests/node_modules/protobufjs/src/reader.js:63:23)
cypress-1  |     at Function.create_buffer_setup (/tests/node_modules/protobufjs/src/reader.js:64:15)
cypress-1  |     at Function.decode (/tests/node_modules/echoed/dist/integration/cypress/nodeEvents/index.js:973:36)
cypress-1  |     at OtelTraceController.post (/tests/node_modules/echoed/dist/integration/cypress/nodeEvents/index.js:27434:35)
cypress-1  |     at /tests/node_modules/echoed/dist/integration/cypress/nodeEvents/index.js:28053:51
cypress-1  |     at asyncUtilWrap (/tests/node_modules/express-async-handler/index.js:3:20)
cypress-1  |     at Layer.handle [as handle_request] (/tests/node_modules/express/lib/router/layer.js:95:5)
cypress-1  |     at next (/tests/node_modules/express/lib/router/route.js:149:13)
cypress-1  |     at Route.dispatch (/tests/node_modules/express/lib/router/route.js:119:3)
cypress-1  |     at Layer.handle [as handle_request] (/tests/node_modules/express/lib/router/layer.js:95:5)
cypress-1  |     at /tests/node_modules/express/lib/router/index.js:284:15
cypress-1  |     at Function.process_params (/tests/node_modules/express/lib/router/index.js:346:12)
cypress-1  |     at next (/tests/node_modules/express/lib/router/index.js:280:10)
cypress-1  |     at rawParser (/tests/node_modules/echoed/dist/integration/cypress/nodeEvents/index.js:22177:11)
cypress-1  |     at Layer.handle [as handle_request] (/tests/node_modules/express/lib/router/layer.js:95:5)
cypress-1  |     at trim_prefix (/tests/node_modules/express/lib/router/index.js:328:13)
cypress-1  |     at /tests/node_modules/express/lib/router/index.js:286:9
cypress-1  |     at Function.process_params (/tests/node_modules/express/lib/router/index.js:346:12)
cypress-1  |     at next (/tests/node_modules/express/lib/router/index.js:280:10)
cypress-1  |     at /tests/node_modules/body-parser/lib/read.js:137:5
cypress-1  |     at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
cypress-1  |     at invokeCallback (/tests/node_modules/raw-body/index.js:238:16)
cypress-1  |     at done (/tests/node_modules/raw-body/index.js:227:7)
cypress-1  |     at IncomingMessage.onEnd (/tests/node_modules/raw-body/index.js:287:7)
cypress-1  |     at IncomingMessage.emit (node:events:519:28)
cypress-1  |     at IncomingMessage.emit (node:domain:488:12)
cypress-1  |     at endReadableNT (node:internal/streams/readable:1696:12)
cypress-1  |     at processTicksAndRejections (node:internal/process/task_queues:82:21)
cypress-1  | [Echoed] waiting for OpenTelemetry for 20 seconds...................
cypress-1  | [Echoed] ✓ Propagation test
cypress-1  | [Echoed] Report file is generated at report/result.html

It does look like the decode method of src/server/constroller/otelTraceController.ts in import TracesData = opentelemetry.proto.trace.v1.TracesData; is causing this issue. Perhaps the version in Echoed is too old?

meastp commented 1 month ago

This might be relevant, I'm not too familiar with express/javascript/typescript: https://github.com/protobufjs/protobuf.js/issues/869#issuecomment-722014620 and https://github.com/protobufjs/protobuf.js/wiki/How-to-read-binary-data-in-the-browser-or-under-node.js%3F#nodejs-properly-using-buffers

meastp commented 1 month ago

nevermind - I incorrectly used the default configuration of an old opentelemetry-cpp export config (using json instead of binary)