Skip to content

Commit 192a36d

Browse files
committed
Handle unparseable data in Docker event stream
Not clear what this actually is, but hopefully this will let us skip it, and logging it should help diagnose the issue, if it's actually something important (but I suspect it's actually some whitespace-only keep-alive data or similar).
1 parent dcf9b96 commit 192a36d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/interceptors/docker/docker-networking.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ function getDockerEventStream(docker: Docker) {
3535
EventStream.split(),
3636
EventStream.mapSync((buffer: Buffer) => buffer.toString('utf8')),
3737
EventStream.filterSync((line: string) => line.length > 0),
38-
EventStream.mapSync((rawLine: string) => JSON.parse(rawLine))
38+
EventStream.mapSync((rawLine: string) => {
39+
try {
40+
return JSON.parse(rawLine);
41+
} catch (e) {
42+
console.warn(`Unparseable Docker event data: ${rawLine}`);
43+
return {};
44+
}
45+
})
3946
);
4047

4148
// We expose the stream immediately, even though no data is coming yet

0 commit comments

Comments
 (0)