bun
bun copied to clipboard
Bun using restify: stream_wrap error
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
Yeah had same issue with my restify server
Potentially fixed as part of https://github.com/oven-sh/bun/issues/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
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
Having the same issue trying to run rest servers. Lot of people would love to use bun with a restify dependency.
Any update on this? It's still present with 1.0.14.
It's still present with 1.0.16.
It's still present with 1.1.2.
This prevents this package from working: https://www.npmjs.com/package/spdy