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

socketPath issue with node:http #6055

Closed
robobun opened this issue Sep 25, 2023 · 7 comments · Fixed by #9284
Closed

socketPath issue with node:http #6055

robobun opened this issue Sep 25, 2023 · 7 comments · Fixed by #9284
Labels
bug Something isn't working node.js Compatibility with Node.js APIs

Comments

@robobun
Copy link

robobun commented Sep 25, 2023

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

@Zampare
Copy link

Zampare commented Sep 25, 2023

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;
}

@Electroid Electroid added bug Something isn't working node.js Compatibility with Node.js APIs and removed node.js Compatibility with Node.js APIs labels Sep 25, 2023
@hazelnutcloud
Copy link

the dockerode package is unusable because of this bug.

@ImLunaHey
Copy link
Contributor

Duplicate of #2853?

@siinghd
Copy link

siinghd commented Feb 11, 2024

Any update on this? Can't use dockerode

@isaced
Copy link

isaced commented Feb 11, 2024

+1, for dockerode

@Anprotaku
Copy link

+1 for dockerode
is there any temp fix for this?

@ImLunaHey
Copy link
Contributor

please stop bumping this to leave a +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node.js Compatibility with Node.js APIs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants