Scott Bender - @Teppo Kurki @bkeepers currentlu...
@Teppo Kurki @bkeepers currentluy with main branch I am getting
30 Replies
are you sure you have latest? https://github.com/SignalK/signalk-server/pull/1945 should have fixed that
GitHub
fix: fix streambundle error after port to TypeScript by bkeepers ·...
This fixes an error reported by @KEGustafsson introduced in #1918. I have not been able to recreate it, but apparently there are instances where update.values is present, but is not an array. Looki...
yes
when I change that code
if ('values' in update) {
to if ( update.values )
it goes away
the delta is
running with freshly pulled
docker run -p 3000:3000 -it --rm signalk/signalk-server:master
and entering
gives me the value in data browser as A's, no error messages. are you sure you've rebuilt everything?don't include 'values' in that delta
just meta
works that way too (just wanted values to verify that A makes it to metadata and is not silently swallowed)
Seeing the same issue as earlier, error comes only at startup from meta.
I get it when I send it via Data Browser
this is a fresh repo today. tested with node v20 and v22
modified the code to
that message gets logged
update.values is undefined, but that
if ('values' in update) {
check is passing
am I crazy?
hmm
so vaules is there, but it is undefined
At some phase streambunle.ts had fix in lines
66 and 77. Now those are gone from merged fix?
GitHub
signalk-server/src/index.ts at master · SignalK/signalk-server
An implementation of a Signal K central server for boats. - SignalK/signalk-server
that's index.ts
it's not in streambundle.ts
not loving this
if ( 'x' in y )
syntaxthe motivation is that after that ts can narrow the type down
but

I don't know how
values
is getting set to undefined in this case......but i think ìf ( 'x' in y )` does not guard against the value being undefined
and we need to add it
everything that goes in streamdbundle should be coming through index.ts/handleMessage, i think? so that's the place to sanitise the data
makes sense, so you think we should change handleMessage to delete
values
if it is undefined?
should it "sanitize" the whole delta?yes, put it in the same if condition that i linked above
now it sanitizes values and meta - and fills in timestamp etc so kinda does that too
I don't understand why this is not happening for you
ah, but
!Array.isArray(undefined)
should catch undefined alreadyhmm. wait, I don't see that
sorry, it's there
check also in your dist/index.js
it's there
and after those checks you have data that has undefined as values? if you add the console.log there
debugging now...
it's getting set to undefined some how after that handleMessage code...
in toPreferredDelta?
yep
how does that evaluate to undefined? values is always an array, so it reduces to an array
but it's not an array
it's not there
since this delta just has meta
so update.values is
undefined
anything but Array as values gets deleted https://github.com/SignalK/signalk-server/blob/29cfc73018e49603b171322e441414f7bb726224/src/index.ts#L298-L301
GitHub
signalk-server/src/index.ts at 29cfc73018e49603b171322e441414f7bb72...
An implementation of a Signal K central server for boats. - SignalK/signalk-server
yeah, so it's not there
so update.values evaluates to
undefined
this needs a if ( 'values' in update )
check👍
PR coming...
hmm. tests are not running?
oh, there they go
sorry, somehow I missed this whole thread