I've got a separate front end application that is calling my Loopback 4 API endpoints. When the front end application's page is refreshed too quickly, my Loopback 4 API produces this error:
Error: Cannot set headers after they are sent to the client
at new NodeError (node:internal/errors:371:5)
at ServerResponse.setHeader (node:_http_outgoing:576:11)
at ServerResponse.header (/Users/caleb.beery/sites/trimaster-lb4/node_modules/express/lib/response.js:794:10)
at HttpContext.done (/Users/caleb.beery/sites/trimaster-lb4/node_modules/strong-remoting/lib/http-context.js:580:9)
at /Users/caleb.beery/sites/trimaster-lb4/node_modules/strong-remoting/lib/rest-adapter.js:540:11
at /Users/caleb.beery/sites/trimaster-lb4/node_modules/async/dist/async.js:3681:19
at wrapper (/Users/caleb.beery/sites/trimaster-lb4/node_modules/async/dist/async.js:271:20)
at replenish (/Users/caleb.beery/sites/trimaster-lb4/node_modules/async/dist/async.js:441:29)
at iterateeCallback (/Users/caleb.beery/sites/trimaster-lb4/node_modules/async/dist/async.js:430:21)
at /Users/caleb.beery/sites/trimaster-lb4/node_modules/async/dist/async.js:327:20
at /Users/caleb.beery/sites/trimaster-lb4/node_modules/async/dist/async.js:3679:17
at interceptInvocationErrors (/Users/caleb.beery/sites/trimaster-lb4/node_modules/strong-remoting/lib/remote-objects.js:731:22)
at /Users/caleb.beery/sites/trimaster-lb4/node_modules/loopback-phase/node_modules/async/dist/async.js:473:16
at replenish (/Users/caleb.beery/sites/trimaster-lb4/node_modules/loopback-phase/node_modules/async/dist/async.js:1009:25)
at iterateeCallback (/Users/caleb.beery/sites/trimaster-lb4/node_modules/loopback-phase/node_modules/async/dist/async.js:998:17)
at /Users/caleb.beery/sites/trimaster-lb4/node_modules/loopback-phase/node_modules/async/dist/async.js:972:16
Some information about the Loopback 4 app:
This contains a partially migrated Loopback 3 application in the "lb3app" directory in the root of the project. Some of the front end application's API calls are hitting the Loopback 4 endpoints and some of them are hitting the Loopback 3 endpoints.
I'm not really even sure how to start debugging this. Any suggestions?