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

request for unknown status list crashes workflow-coordinator #21

Closed
jchartrand opened this issue Oct 19, 2024 · 1 comment
Closed

request for unknown status list crashes workflow-coordinator #21

jchartrand opened this issue Oct 19, 2024 · 1 comment
Assignees

Comments

@jchartrand
Copy link
Contributor

Describe the bug

When making a call to the workflow coordinator's '/status/:statusCredentialId' endpoint with a statusCredentialId for which there is no status list, the coordinator calls the status-service, which correctly returns a 404, which the workflow-coordinator middleware handles, but the workflow coordinator's '/status/:statusCredentialId' method still incorrectly tries to return a second response (a 500), which crashes the server with error:

node:internal/errors:496
ad-coordinator   |     ErrorCaptureStackTrace(err);
ad-coordinator   |     ^
ad-coordinator   | 
ad-coordinator   | Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
ad-coordinator   |     at new NodeError (node:internal/errors:405:5)
ad-coordinator   |     at ServerResponse.setHeader (node:_http_outgoing:648:11)
ad-coordinator   |     at ServerResponse.header (/app/node_modules/express/lib/response.js:767:10)
ad-coordinator   |     at ServerResponse.send (/app/node_modules/express/lib/response.js:170:12)
ad-coordinator   |     at ServerResponse.json (/app/node_modules/express/lib/response.js:267:15)
ad-coordinator   |     at ServerResponse.send (/app/node_modules/express/lib/response.js:158:21)
ad-coordinator   |     at file:///app/src/app.js:230:36
ad-coordinator   |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
ad-coordinator   |   code: 'ERR_HTTP_HEADERS_SENT'
ad-coordinator   | }
ad-coordinator   | 
ad-coordinator   | Node.js v18.20.4

Essentially the error gets handled twice, with two responses.

To Reproduce
Steps to reproduce the behavior:

  1. request an unknown statusId from /status/:statusId

Expected behavior
Should instead return a 404

@alexfigtree
Copy link
Member

Completed, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done (Deployed)
Development

No branches or pull requests

2 participants