Skip to content

Commit bc50fd3

Browse files
authored
fix: Ignore context cancelled errors. (#2091)
fixes cloudquery/cloudquery-issues#3451 The CLI closes the context that the Transformer plugin uses upon completion of the sync. This is not an error, so the SDK should not raise it in the `Transform` function. This error is benign in that the sync still works as expected, but it looks bad in the logs, which end up showing up in `cloudquery.log`, and it bubbles up to other products like Asset Inventory which happens to show errors in bright red colours. Here's a typical current run <img width="877" alt="Screenshot 2025-03-07 at 10 57 36" src="https://github.com/user-attachments/assets/5ce61a18-b7a1-4f47-89ca-c3a8e620487d" /> Here's a fixed run <img width="949" alt="Screenshot 2025-03-07 at 10 54 49" src="https://github.com/user-attachments/assets/239f7665-48b1-49c5-a0bc-84db8a89efee" />
1 parent c4c9cd6 commit bc50fd3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/servers/plugin/v3/plugin.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,10 @@ func (s *Server) Transform(stream pb.Plugin_TransformServer) error {
456456
}
457457
if err != nil {
458458
close(recvRecords)
459+
if status.Code(err) == codes.Canceled {
460+
// Ignore context cancellation errors
461+
return nil
462+
}
459463
return status.Errorf(codes.Internal, "Error receiving request: %v", err)
460464
}
461465
record, err := pb.NewRecordFromBytes(req.Record)

0 commit comments

Comments
 (0)