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

deno #320

Open
paulhendrix opened this issue Dec 1, 2023 · 7 comments
Open

deno #320

paulhendrix opened this issue Dec 1, 2023 · 7 comments

Comments

@paulhendrix
Copy link

test.js:

import * as fb from "npm:node-firebird";

let options = {};
options.host = "localhost";
options.port = 3050;
options.database = "test1";
options.user = "SYSDBA";
options.password = "masterkey";

fb.attach(options, function (err, db) {
console.log("debug1");
});

deno run -A test.js

under deno callback is never called, under node.js works ok

@diegompbh
Copy link

Has anyone resolved this problem?
Some silent error occurs on this line:

cb.response.removeAllListeners('error');

File: connection.js
Line: 1799

image

@paulhendrix
Copy link
Author

I managed to trace the internal error that occurs, and the cause is a missing function 'removeAllListeners'.
Now, how can we fix it?

TypeError: cb.response.removeAllListeners is not a function
at exports.Connection.Connection.attach (file:///test/firebird/problem_deno/node_modules/.deno/[email protected]/node_modules/node-firebird/lib/index.js:3687:21)
at file:///test/firebird/problem_deno/node_modules/.deno/[email protected]/node_modules/node-firebird/lib/index.js:1757:25
at cb (file:///test/firebird/problem_deno/node_modules/.deno/[email protected]/node_modules/node-firebird/lib/index.js:3615:13)
at doCallback (file:///test/firebird/problem_deno/node_modules/.deno/[email protected]/node_modules/node-firebird/lib/index.js:1368:5)
at file:///test/firebird/problem_deno/node_modules/.deno/[email protected]/node_modules/node-firebird/lib/index.js:3140:21
at decodeResponse (file:///test/firebird/problem_deno/node_modules/.deno/[email protected]/node_modules/node-firebird/lib/index.js:3419:24)
at Socket. (file:///test/firebird/problem_deno/node_modules/.deno/[email protected]/node_modules/node-firebird/lib/index.js:3115:13)
at Socket.emit (ext:deno_node/_stream.mjs:1851:9)
at addChunk (ext:deno_node/_stream.mjs:2873:16)
at readableAddChunk (ext:deno_node/_stream.mjs:2852:13) {stack: 'TypeError: cb.response.removeAllListeners is …eAddChunk (ext:deno_node/_stream.mjs:2852:13)', message: 'cb.response.removeAllListeners is not a function', __callSiteEvals: Array(10)}

@diegompbh
Copy link

I haven't tested it enough yet, but I at least got it working.
Everywhere socket functions are used, I added ._socket. And I manually set it where I saw it was undefined.
Example:

image

The solution, at least temporarily, may be along this way.

@paulhendrix
Copy link
Author

Great!
I will test it and let you know

@diegompbh
Copy link

With the update to version 1.1.9, I had to redo the changes. I will attach the files here. I haven't done a full test yet, but it appears to be working.

lib.zip

@pwypustek
Copy link

Your change appears to be working correctly in both Deno and Node.js. It would be great if we could update this change in the official version of node-firebird, or alternatively, add the improved node-firebird module to https://jsr.io ?

@pwypustek
Copy link

I've noticed another problem with handling the pool in the file pool.js
db.on('detach'...
=>
db._socket.on('detach'...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants