Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ui] Rust UI Simulation: Error Handling in API Message Processing: Cannot read properties of undefined and Invalid state: Controller is already closed #160

Closed
will-break-it opened this issue Jan 22, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@will-break-it
Copy link
Contributor

Description

While running the UI web app with the latest from main, an error occurs during the processing of messages in the API. The error logs indicate issues with undefined properties and invalid state management in the message processing logic.

Additional Information

The issue occurs in the src/app/api/messages/batch/utils.ts and src/app/api/messages/batch/route.ts files.
The error impacts the /api/messages/batch endpoint.

Stacktrace

 ⨯ Error: failed to pipe response
    at pipeToNodeResponse (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/pipe-readable.ts:144:10)
    at async sendResponse (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/send-response.ts:69:6)
    at async doRender (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/base-server.ts:2618:12)
    at async responseGenerator (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/base-server.ts:3066:21)
    at async DevServer.renderToResponseWithComponentsImpl (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/base-server.ts:3121:23)
    at async DevServer.renderPageComponent (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/base-server.ts:3676:15)
    at async DevServer.renderToResponseImpl (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/base-server.ts:3738:23)
    at async DevServer.pipeImpl (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/base-server.ts:1738:20)
    at async NextNodeServer.handleCatchallRenderRequest (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/next-server.ts:1032:6)
    at async DevServer.handleRequestImpl (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/base-server.ts:1498:8)
    at async (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/dev/next-dev-server.ts:514:13)
    at async Span.traceAsyncFn (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/trace/trace.ts:143:13)
    at async DevServer.handleRequest (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/dev/next-dev-server.ts:512:19)
    at async invokeRender (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/lib/router-server.ts:284:10)
    at async handleRequest (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/lib/router-server.ts:530:15)
    at async requestHandlerImpl (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/lib/router-server.ts:576:6)
    at async Server.requestListener (file:///Users/will/Workspace/io/ouroboros-leios/ui/node_modules/next/src/server/lib/start-server.ts:146:6) {
  [cause]: TypeError: Cannot read properties of undefined (reading 'toString')
      at processMessage (turbopack://[project]/src/app/api/messages/batch/utils.ts:130:20)
      at Timeout._onTimeout (turbopack://[project]/src/app/api/messages/batch/route.ts:156:29)
    128 |     incrementNodeAggregationData(
    129 |       aggregatedData.nodes,
  > 130 |       message.id.id.toString(),
        |                    ^
    131 |       "votesGenerated",
    132 |     );
    133 |   } else if (message.type === EMessageType.VotesSent) {
}
@will-break-it will-break-it added the bug Something isn't working label Jan 22, 2025
@SupernaviX
Copy link
Contributor

There had been a bug in the format of the VotesGenerated message, which I accidentally fixed yesterday while switching to human-readable IDs (I hadn't noticed the bug or the fix). Updated the UI to depend on the data format we intended to send.

@cjkoepke
Copy link
Collaborator

Thanks for the fix, @SupernaviX!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants