sailscastshq / boring-stack

Ship JavaScript products with battle-tested technologies in days not weeks.
https://docs.sailscasts.com/boring-stack/getting-started
MIT License
390 stars 19 forks source link

When more than 2 users are logged in #78

Closed davidtwin closed 5 months ago

davidtwin commented 6 months ago

Description

When there are more than 2 users logged in and are making a request to server at the same time, I get an error

error: Sending 500 ("Server Error") response: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client at new NodeError (node:internal/errors:405:5) at ServerResponse.setHeader (node:_http_outgoing:652:11) at ServerResponse.header (/Users/DavidMendesDaSilva/Sites/h2pro-webapp/node_modules/express/lib/response.js:776:10) at ServerResponse.send (/Users/DavidMendesDaSilva/Sites/h2pro-webapp/node_modules/express/lib/response.js:170:12) at ServerResponse.json (/Users/DavidMendesDaSilva/Sites/h2pro-webapp/node_modules/express/lib/response.js:267:15) at hook.render (/Users/DavidMendesDaSilva/Sites/h2pro-webapp/node_modules/inertia-sails/private/inertia-middleware.js:52:20) at Object.fn (/Users/DavidMendesDaSilva/Sites/h2pro-webapp/api/controllers/order/view-orders.js:168:26) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ...

Current behavior

only one user request is getting completed and the other one normally gets the error and crashes. ...

Expected behavior

Both users should be able to make requests at the same time ...

Replace space in square bracket with x e.g [x]

[x] I have checked and this issue does not exist

DominusKelvin commented 6 months ago

Thanks @davidtwin for submitting this issue, I'll make a reproduction and see why this is an issue.

DominusKelvin commented 6 months ago

Yeah this seems to be the offending code in inertia-sails

CleanShot 2024-02-20 at 12 22 57@2x

DominusKelvin commented 6 months ago

Hey @davidtwin, I've solved this issue and the changes will be a 0.2.0 release of inertia-sails.

DominusKelvin commented 6 months ago

Hey @davidtwin here is the guide for when you want to upgrade, let me know if this fixes the issue for you too.

https://blog.sailscasts.com/boring-stack-v-0-2-0

DominusKelvin commented 5 months ago

Closing this issue as this has been resolved by #86 and #87