Closed
Description
try await withGRPCClient(transport: transport) { client in
let agent = Edge_Agent_Services_V1_EdgeAgentService.Client(wrapping: client)
try await agent.uploadFile { writer in
throw SomeError() // Error immediately occurs due to file does not exist
}
}
In a nutshell this is what reproduces the issue. We have a _NIOFileSystem
FileHandle in the place of the body:
try await FileSystem.shared.withFileHandle(forReadingAt: FilePath(binary)) { handle in
// Upload data over gRPC
}
Because the file did not exist, this immediately throws an error resulting in a crash:
GRPCNIOTransportCore/GRPCStreamStateMachine.swift:1062: Fatal error: Server is closed, nothing could have been sent.