bun
bun copied to clipboard
`socketPath` issue with node:http
Building a docker extension and am using bun.serve which is working great when the front end wants to talk to the backend. But I want to initiate some UNIX socket requests and am having some issues doing that. What would be the best way to go about it?
Originally reported on Discord: UNIX socket requests in BUN
went over to just using http.request and that still doesnt work in bun. So I'm wondering if socketPath as an option just didn't get implemented. What my code looks like:
import http from 'node:http';
async function getDockerContainers(): Promise<Container[]> {
const options = {
socketPath: '/var/run/docker.sock',
method: 'GET',
path: '/containers/json',
};
const data = await new Promise<Container[]>((resolve, reject) => {
const req = http.request(options, res => {
console.log(res);
let rawData = '';
res.on('data', chunk => {
rawData += chunk;
});
res.on('end', () => {
resolve(JSON.parse(rawData));
});
});
req.end();
});
const containers = data;
return containers;
}
the dockerode package is unusable because of this bug.
Duplicate of https://github.com/oven-sh/bun/issues/2853?
Any update on this? Can't use dockerode
+1, for dockerode
+1 for dockerode is there any temp fix for this?
please stop bumping this to leave a +1