sillsdev / sillsdev/languageforge-lexbox
First lexbox requests hitting vite proxy fail after local deployment
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 9
- Forks
- 8
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 49
Description
The first request that hits the lexbox deployment (lexbox-api & otel-collector) via the vite proxy always seems to fail.
(I can't trigger the error if I run task up and access the app at localhost.)
To reproduce
- Start the cluster without the ui (if it's not already running)
- e.g.
task backend-up
- Kill the containers:
k8s_POD_lexbox-***...k8s_lexbox-api_lexbox-***...(you don't have to kill this one, but it causes everything to restart faster)
- Wait for the successful health check log
- (e.g.)
Request finished HTTP/1.1 GET http://10.1.1.98:5158/api/healthz - - - 200 - text/plain 57.5309ms
- Try one of the following scenarios
1. 1st & 2nd requests hit proxy = 💥 & 🟢
Invoke-WebRequest -Uri "http://localhost:3000/api/login"
💥 ===>The remote server returned an error: (500) Internal Server Error.
Error: socket hang up
at connResetException (node:internal/errors:704:14)
at Socket.socketOnEnd (node:_http_client:505:23)
at Socket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ECONNRESET'
}
Invoke-WebRequest -Uri "http://localhost:3000/api/login"
🟢 ===>The remote server returned an error: (401) Unauthorized.
1. 1st request hits ingress & 2nd request hits proxy = 🟢 & 🟢
-
Invoke-WebRequest -Uri "http://localhost:5158/api/login"
🟢 ===>The remote server returned an error: (401) Unauthorized. -
Invoke-WebRequest -Uri "http://localhost:3000/api/login"
🟢 ===>The remote server returned an error: (401) Unauthorized.
Debugging
You can hook into the proxy client's events for further debugging. E.g.:
'/api': {
target: 'http://localhost:5158',
toProxy: true,
timeout: 1200000,
proxyTimeout: 1200000,
followRedirects: true,
configure: (proxy, _options) => {
proxy.on('error', (err, _req, _res, target) => {
console.log('PROXY - api - error', err, _req.headers.host, target);
});
proxy.on('proxyReq', (proxyReq, req, _res) => {
console.log('Proxy request', proxyReq);
console.log('PROXY - api - request:', req.method, req.headers.host, req.url);
});
proxy.on('proxyRes', (proxyRes, req, _res) => {
console.log('PROXY - api - response:', proxyRes.statusCode, req.headers.host, req.url);
});
},
},
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Vite proxy configuration shown in the issue and reproduce the failure using task backend-up, the container restarts, and the /api/login requests on ports 3000 and 5158. Use the proxy client event hooks described in the issue to compare the first proxied request with the direct ingress request. Done means the first request through the Vite proxy no longer returns a 500/socket hang up and instead behaves like the direct request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kubernetes, vite
- Domain
- devops, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100