What is the status of Node SDK?

What is the status of the Node SDK? From the GitHub repo it seems like the code it self have not seen any love this year. And when I try to use it to create a dark express app I find it very unstable. C backend crashes while the node frontend continues to run aka zombie mode. Segfaults and freeing of invalid pointers.

The reason I am asking there is no point in me spending time to create "good" bug reports if the node sdk is mostly abandoned. Especially as it seems the bugs a flaky and racy. Hard to pin down. Then my time is better spent going to another language or use tunnels.

OpenZiti was all fun and games until the segmentation faults happened :wink:

Hello @gjersvik - Welcome to the community, and thank you for posting this (and sorry to hear about the seg fault). Last week, we identified a gap in rolling out updates to our C SDK to dependent SDKs (most notably the Node SDK). We expect to update the Node SDK this coming week.

Sound good. I will put the node js app on the backburner until then. If i still have stability issues after i will start filing bug reports.

Now to my next adventure. Calling the c sdk from rust. :crab:

2 Likes

Quick update - key resource is out this week, so we'll likely hold off on pushing the release until they are back next week.

1 Like

Thanks for the update. It seems like after a lot of cursing at not understanding linking i was finally able to get the rust build tools to give me a :+1:

I am back to node. And a pattern emerges on the bugs.

Now I have an express route that do a web request before replying. So now wen I run the service. And connect to with the browser over ziti. Service handle the request. Browser gets nothing. Refreshes page imitate get the previous request to service.

And service starts getting exceptions: (node:23538) [DEP0168] DeprecationWarning: Uncaught N-API callback exception detected, please run node with option --force-node-api-uncaught-exceptions-policy=trueto handle those exceptions properly. (Use node --trace-deprecation ... to show where the warning was created)
And some times later: (23538)[ 90.873] ERROR ziti-sdk:connect.c:1269 ziti_write() conn[0.1/Disconnected] attempted write after ziti_close_write()

It seems that somewhere between express in node and the browser. The state of the connection goes out of sync and that leads to glorious land of Undefined Behavior. Write after free, Segmentation fault all the good stuff.

Plan todo a full bug report with code samples if the issue persist after next version. :wink:

what version of nodeJS are you using?

Lastest stable: v18.18.0 inside the bookworm dev container. As there was no prebuilt for windows 10.

Any update on a new version of node sdk?

Hi @gjersvik - thank you for your patience. The PR is up and still under review: Use cmake-js by ekoby · Pull Request #68 · openziti/ziti-sdk-nodejs · GitHub

Just to give an update -- we are very close to getting the next release out

1 Like

the new version (0.14.0) is out! give it a try and please report any issues

1 Like

I am on a small vacation will give it a try on Monday.

Hi have finally gotten around to try out the new node version. Have a bit off an issue with enrolling new idenety for testing. It fails witout an error.

node enrole.mjs key.jwt
Specified Enrollment JWT is ('key.jwt')
[        0.003] DEBUG   ziti-sdk-nodejs//home/runner/work/ziti-sdk-nodejs/ziti-sdk-nodejs/src/ziti_enroll.c:165 _ziti_enroll(): entered
(11658)[        0.000]    INFO ziti-sdk:utils.c:199 ziti_log_set_level() set log level: root=5/VERBOSE
(11658)[        0.000]    INFO ziti-sdk:utils.c:168 ziti_log_init() Ziti C SDK version 0.35.4.1 @a0c5ea3(HEAD) starting at (2023-11-17T10:51:27.158)
(11658)[        0.000]    INFO ziti-sdk:ziti_enroll.c:90 ziti_enroll() Ziti C SDK version 0.35.4.1 @a0c5ea3(HEAD) starting enrollment at (2023-11-17T10:51:27.158)
(11658)[        0.000]   DEBUG ziti-sdk:jwt.c:82 load_jwt() filename is: key.jwt
(11658)[        0.000]   DEBUG ziti-sdk:jwt.c:75 load_jwt_file() jwt file content is: [REDACTED]
(11658)[        0.000]   DEBUG ziti-sdk:jwt.c:36 parse_jwt_content() ecfg->jwt_signing_input is: [REDACTED]
(11658)[        0.000]   DEBUG ziti-sdk:ziti_ctrl.c:412 ziti_ctrl_init() ctrl[REDACTED] ziti controller client initialized
(11658)[        0.000] VERBOSE ziti-sdk:ziti_ctrl.c:141 start_request() ctrl[REDACTED] starting GET[/.well-known/est/cacerts]

But when try to call /.well-known/est/cacerts on my controller from the browser I get 404 error with: Cannot GET /.well-known/est/cacerts

The script I use was:

import fs from 'fs';
import ziti from '@openziti/ziti-sdk-nodejs';

let jwt_path = process.argv[2];

console.log('Specified Enrollment JWT is (%o)', jwt_path);

ziti.setLogLevel(5);

ziti.ziti_enroll(jwt_path, (data) => {
    if (data.identity) {
        console.log("data is:\n\n%s", data);

        if (data.identity) {
            fs.writeFileSync('identity.json', data.identity);
        }
    } else {
        console.log('Enroll failed with error (%o)', data);
    }
});

Controller version: Controller: v0.30.4 ZAC: 2.9.1