@openfn/ws-worker 1.11.1 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/index.js +12 -34
- package/dist/start.js +12 -34
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# ws-worker
|
|
2
2
|
|
|
3
|
+
## 1.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e2f1197: Better logging on credential errors
|
|
8
|
+
- Updated dependencies [e2f1197]
|
|
9
|
+
- @openfn/engine-multi@1.6.1
|
|
10
|
+
|
|
11
|
+
## 1.12.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- d50c05d: Fix an issue where large payloads can cause the worker to OOM crash
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [deb7293]
|
|
20
|
+
- Updated dependencies [d50c05d]
|
|
21
|
+
- @openfn/engine-multi@1.6.0
|
|
22
|
+
|
|
3
23
|
## 1.11.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -598,22 +598,6 @@ var calculateRunExitReason = (state) => {
|
|
|
598
598
|
return { reason: "success", error_type: null, error_message: null };
|
|
599
599
|
};
|
|
600
600
|
|
|
601
|
-
// src/util/ensure-payload-size.ts
|
|
602
|
-
var ensure_payload_size_default = (payload, limit_mb) => {
|
|
603
|
-
if (!isNaN(limit_mb)) {
|
|
604
|
-
const limit = limit_mb;
|
|
605
|
-
const size_bytes = Buffer.byteLength(payload, "utf8");
|
|
606
|
-
const size_mb = size_bytes / 1024 / 1024;
|
|
607
|
-
if (size_mb > limit) {
|
|
608
|
-
const e = new Error();
|
|
609
|
-
e.severity = "kill";
|
|
610
|
-
e.name = "PAYLOAD_TOO_LARGE";
|
|
611
|
-
e.message = `The payload exceeded the size limit of ${limit}mb`;
|
|
612
|
-
throw e;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
};
|
|
616
|
-
|
|
617
601
|
// src/events/step-complete.ts
|
|
618
602
|
async function onStepComplete(context, event, error) {
|
|
619
603
|
const { channel, state, options } = context;
|
|
@@ -639,25 +623,24 @@ async function onStepComplete(context, event, error) {
|
|
|
639
623
|
thread_id: event.threadId,
|
|
640
624
|
timestamp: timeInMicroseconds(event.time)
|
|
641
625
|
};
|
|
642
|
-
|
|
643
|
-
if (!options || options.outputDataclips !== false) {
|
|
644
|
-
const payload = stringify_default(outputState);
|
|
645
|
-
ensure_payload_size_default(payload, options?.payloadLimitMb);
|
|
646
|
-
evt.output_dataclip = payload;
|
|
647
|
-
}
|
|
648
|
-
evt.output_dataclip_id = dataclipId;
|
|
649
|
-
} catch (e) {
|
|
626
|
+
if (event.redacted) {
|
|
650
627
|
state.withheldDataclips[dataclipId] = true;
|
|
651
628
|
evt.output_dataclip_error = "DATACLIP_TOO_LARGE";
|
|
652
629
|
const time = (timestamp2() - BigInt(1e7)).toString();
|
|
653
630
|
await onJobLog(context, {
|
|
654
631
|
time,
|
|
655
632
|
message: [
|
|
656
|
-
"Dataclip
|
|
633
|
+
"Dataclip exceeds payload limit: output will not be sent back to the app."
|
|
657
634
|
],
|
|
658
635
|
level: "info",
|
|
659
636
|
name: "R/T"
|
|
660
637
|
});
|
|
638
|
+
} else {
|
|
639
|
+
evt.output_dataclip_id = dataclipId;
|
|
640
|
+
if (!options || options.outputDataclips !== false) {
|
|
641
|
+
const payload = stringify_default(outputState);
|
|
642
|
+
evt.output_dataclip = payload;
|
|
643
|
+
}
|
|
661
644
|
}
|
|
662
645
|
const reason = calculateJobExitReason(job_id, event.state, error);
|
|
663
646
|
state.reasons[job_id] = reason;
|
|
@@ -843,24 +826,19 @@ function onJobError(context, event) {
|
|
|
843
826
|
}
|
|
844
827
|
function onJobLog({ channel, state, options }, event) {
|
|
845
828
|
let message = event.message;
|
|
846
|
-
|
|
847
|
-
if (typeof event.message === "string") {
|
|
848
|
-
ensure_payload_size_default(event.message, options?.payloadLimitMb);
|
|
849
|
-
message = JSON.parse(message);
|
|
850
|
-
} else if (event.message) {
|
|
851
|
-
const payload = stringify_default(event.message);
|
|
852
|
-
ensure_payload_size_default(payload, options?.payloadLimitMb);
|
|
853
|
-
}
|
|
854
|
-
} catch (e) {
|
|
829
|
+
if (event.redacted) {
|
|
855
830
|
message = [
|
|
856
831
|
`(Log message redacted: exceeds ${options.payloadLimitMb}mb memory limit)`
|
|
857
832
|
];
|
|
833
|
+
} else if (typeof event.message === "string") {
|
|
834
|
+
message = JSON.parse(event.message);
|
|
858
835
|
}
|
|
859
836
|
const log = {
|
|
860
837
|
run_id: state.plan.id,
|
|
861
838
|
message,
|
|
862
839
|
source: event.name,
|
|
863
840
|
level: event.level,
|
|
841
|
+
// @ts-ignore
|
|
864
842
|
timestamp: timeInMicroseconds(event.time)
|
|
865
843
|
};
|
|
866
844
|
if (state.activeStep) {
|
package/dist/start.js
CHANGED
|
@@ -738,22 +738,6 @@ var calculateRunExitReason = (state) => {
|
|
|
738
738
|
return { reason: "success", error_type: null, error_message: null };
|
|
739
739
|
};
|
|
740
740
|
|
|
741
|
-
// src/util/ensure-payload-size.ts
|
|
742
|
-
var ensure_payload_size_default = (payload, limit_mb) => {
|
|
743
|
-
if (!isNaN(limit_mb)) {
|
|
744
|
-
const limit = limit_mb;
|
|
745
|
-
const size_bytes = Buffer.byteLength(payload, "utf8");
|
|
746
|
-
const size_mb = size_bytes / 1024 / 1024;
|
|
747
|
-
if (size_mb > limit) {
|
|
748
|
-
const e = new Error();
|
|
749
|
-
e.severity = "kill";
|
|
750
|
-
e.name = "PAYLOAD_TOO_LARGE";
|
|
751
|
-
e.message = `The payload exceeded the size limit of ${limit}mb`;
|
|
752
|
-
throw e;
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
|
|
757
741
|
// src/events/step-complete.ts
|
|
758
742
|
async function onStepComplete(context, event, error) {
|
|
759
743
|
const { channel, state, options } = context;
|
|
@@ -779,25 +763,24 @@ async function onStepComplete(context, event, error) {
|
|
|
779
763
|
thread_id: event.threadId,
|
|
780
764
|
timestamp: timeInMicroseconds(event.time)
|
|
781
765
|
};
|
|
782
|
-
|
|
783
|
-
if (!options || options.outputDataclips !== false) {
|
|
784
|
-
const payload = stringify_default(outputState);
|
|
785
|
-
ensure_payload_size_default(payload, options?.payloadLimitMb);
|
|
786
|
-
evt.output_dataclip = payload;
|
|
787
|
-
}
|
|
788
|
-
evt.output_dataclip_id = dataclipId;
|
|
789
|
-
} catch (e) {
|
|
766
|
+
if (event.redacted) {
|
|
790
767
|
state.withheldDataclips[dataclipId] = true;
|
|
791
768
|
evt.output_dataclip_error = "DATACLIP_TOO_LARGE";
|
|
792
769
|
const time = (timestamp2() - BigInt(1e7)).toString();
|
|
793
770
|
await onJobLog(context, {
|
|
794
771
|
time,
|
|
795
772
|
message: [
|
|
796
|
-
"Dataclip
|
|
773
|
+
"Dataclip exceeds payload limit: output will not be sent back to the app."
|
|
797
774
|
],
|
|
798
775
|
level: "info",
|
|
799
776
|
name: "R/T"
|
|
800
777
|
});
|
|
778
|
+
} else {
|
|
779
|
+
evt.output_dataclip_id = dataclipId;
|
|
780
|
+
if (!options || options.outputDataclips !== false) {
|
|
781
|
+
const payload = stringify_default(outputState);
|
|
782
|
+
evt.output_dataclip = payload;
|
|
783
|
+
}
|
|
801
784
|
}
|
|
802
785
|
const reason = calculateJobExitReason(job_id, event.state, error);
|
|
803
786
|
state.reasons[job_id] = reason;
|
|
@@ -983,24 +966,19 @@ function onJobError(context, event) {
|
|
|
983
966
|
}
|
|
984
967
|
function onJobLog({ channel, state, options }, event) {
|
|
985
968
|
let message = event.message;
|
|
986
|
-
|
|
987
|
-
if (typeof event.message === "string") {
|
|
988
|
-
ensure_payload_size_default(event.message, options?.payloadLimitMb);
|
|
989
|
-
message = JSON.parse(message);
|
|
990
|
-
} else if (event.message) {
|
|
991
|
-
const payload = stringify_default(event.message);
|
|
992
|
-
ensure_payload_size_default(payload, options?.payloadLimitMb);
|
|
993
|
-
}
|
|
994
|
-
} catch (e) {
|
|
969
|
+
if (event.redacted) {
|
|
995
970
|
message = [
|
|
996
971
|
`(Log message redacted: exceeds ${options.payloadLimitMb}mb memory limit)`
|
|
997
972
|
];
|
|
973
|
+
} else if (typeof event.message === "string") {
|
|
974
|
+
message = JSON.parse(event.message);
|
|
998
975
|
}
|
|
999
976
|
const log = {
|
|
1000
977
|
run_id: state.plan.id,
|
|
1001
978
|
message,
|
|
1002
979
|
source: event.name,
|
|
1003
980
|
level: event.level,
|
|
981
|
+
// @ts-ignore
|
|
1004
982
|
timestamp: timeInMicroseconds(event.time)
|
|
1005
983
|
};
|
|
1006
984
|
if (state.activeStep) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/ws-worker",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.1",
|
|
4
4
|
"description": "A Websocket Worker to connect Lightning to a Runtime Engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"koa-logger": "^3.2.1",
|
|
23
23
|
"phoenix": "1.7.10",
|
|
24
24
|
"ws": "^8.18.0",
|
|
25
|
-
"@openfn/engine-multi": "1.
|
|
26
|
-
"@openfn/
|
|
25
|
+
"@openfn/engine-multi": "1.6.1",
|
|
26
|
+
"@openfn/logger": "1.0.4",
|
|
27
27
|
"@openfn/runtime": "1.6.3",
|
|
28
|
-
"@openfn/
|
|
28
|
+
"@openfn/lexicon": "^1.2.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/koa": "^2.13.5",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"tsup": "^6.2.3",
|
|
42
42
|
"typescript": "^4.6.4",
|
|
43
43
|
"yargs": "^17.6.2",
|
|
44
|
-
"@openfn/lightning-mock": "2.1.
|
|
44
|
+
"@openfn/lightning-mock": "2.1.3"
|
|
45
45
|
},
|
|
46
46
|
"files": [
|
|
47
47
|
"dist",
|