Skip to content

Bun using restify: stream_wrap error #4957

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

Open
hfabio opened this issue Sep 11, 2023 · 14 comments
Open

Bun using restify: stream_wrap error #4957

hfabio opened this issue Sep 11, 2023 · 14 comments
Labels
bug Something isn't working

Comments

@hfabio
Copy link

hfabio commented Sep 11, 2023

What version of Bun is running?

1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983

What platform is your computer?

Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

create an Api using restify in Bun.

those are the dependencies related to restify:

    "restify": "^11.1.0",
    "restify-cors-middleware": "^1.1.1",
    "restify-router": "^0.6.2",

and this is an example code:

import restify from "restify";
import corsMiddleware from "restify-cors-middleware";

const cors = corsMiddleware({
	preflightMaxAge: 5, //Optional
	origins: ["*"],
	allowHeaders: ["Origin", "X-Requested-With", "Content-Type", "Accept", "Authorization"],
	exposeHeaders: ["Origin", "X-Requested-With", "Content-Type", "Accept", "Authorization"],
});

//configure server name and version
const server = restify.createServer({
	name: "example",
	version: "0.1",
});

//configure cors
server.pre(cors.preflight);
server.use(cors.actual);

//configure restify
server.use(restify.plugins.acceptParser(server.acceptable));
server.use(restify.plugins.queryParser());
server.use(restify.plugins.bodyParser());

server.listen(port, async function () {
	console.log(Array(40).fill("\n").join("")); //clear screen
	console.log("Backend running at %s", server.url);
	//starts cron jobs
	cronController.startCronJobs();
});

What is the expected behavior?

to create a working http server.

What do you see instead?

this is the error I get:

↳ bun run src/server.ts
[0.15ms] ".env"
1 | (function (bindingName){"use strict";if(bindingName==="constants")return @processBindingConstants;const issue={fs:3546,buffer:2020,natives:2254,uv:2891}[bindingName];if(issue)throw new Error(`process.binding("${bindingName}") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/${issue}`);@throwTypeError(`process.binding("${bindingName}") is not implemented in Bun. If that breaks something, please file an issue and include a reproducible code sample.`)})
                       ^
TypeError: process.binding("stream_wrap") is not implemented in Bun. If that breaks something, please file an issue and include a reproducible code sample.
      at binding (:1:20)
      at /home/hfabio/Projetos/vsdbmv2/orchestrator/node_modules/handle-thing/lib/handle.js:17:11
      at globalThis (/home/hfabio/Projetos/vsdbmv2/orchestrator/node_modules/handle-thing/lib/handle.js:262:9)
      at require (:1:20)
      at /home/hfabio/Projetos/vsdbmv2/orchestrator/node_modules/spdy/lib/spdy/handle.js:4:4
      at globalThis (/home/hfabio/Projetos/vsdbmv2/orchestrator/node_modules/spdy/lib/spdy/handle.js:246:3)
      at require (:1:20)
      at /home/hfabio/Projetos/vsdbmv2/orchestrator/node_modules/spdy/lib/spdy.js:6:5

Additional information

debugging my project it only happens when running the restify, socket.io works fine and my project code as well, so probably it is something related to the way restify implements something under the hood

@hfabio hfabio added the bug Something isn't working label Sep 11, 2023
@sjonni1
Copy link

sjonni1 commented Sep 12, 2023

Yeah had same issue with my restify server

@alif-mohdamir
Copy link

alif-mohdamir commented Sep 14, 2023

Potentially fixed as part of #4593, but it hasn't been released yet

Might be worth revisiting if this issues still exists when the associated fix is released

Edit: error still present with 1.0.2 which includes the PR mentioned

@hfabio
Copy link
Author

hfabio commented Oct 7, 2023

version 1.04 still not working

(base) hfabio in orchestrator on  feature/convert-to-bun [!]
↳ bun -version
1.0.4
(base) hfabio in orchestrator on  feature/convert-to-bun [!]
↳ bun --revision
1.0.4+745b6b94ee56cad24d475799690cc9a89957d15b

@electic
Copy link

electic commented Oct 12, 2023

Having the same issue trying to run rest servers. Lot of people would love to use bun with a restify dependency.

@todor-a
Copy link

todor-a commented Nov 27, 2023

Any update on this? It's still present with 1.0.14.

@hfabio
Copy link
Author

hfabio commented Dec 10, 2023

It's still present with 1.0.16.

@joesdu
Copy link

joesdu commented Apr 8, 2024

It's still present with 1.1.2.

@alxivnov
Copy link

alxivnov commented May 7, 2024

This prevents this package from working: https://www.npmjs.com/package/spdy

@ndsung
Copy link

ndsung commented Jul 25, 2024

It's still present with 1.1.20.

@LeParadoxHD
Copy link

Still present in 1.1.29

@VigilioYonatan
Copy link

Still present in 1.1.33

@skitsanos
Copy link

Still exists in 1.1.42

@chenmijiang
Copy link

chenmijiang commented Apr 14, 2025

Still exists in 1.2.9

@Kennytian
Copy link

Still exists in 1.2.15

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

No branches or pull requests