Bug: Conduit crashes when posting an empty JSON to a number of endpoints
Bug description
When posting an empty JSON body to a number of endpoints, Conduit simply crashes. This can be seen with the connectors, processors and pipelines endpoints. I haven't checked others.
Steps to reproduce
Run curl 'localhost:8080/v1/connectors' -d '{}'
Expected results
Conduit replies back with a 400 Bad Request.
Actual results Conduit crashes. Following is seen in logs:
2022-06-14T19:12:30+00:00 INF request processed duration=0.046111 grpc_method=/api.v1.ConnectorService/CreateConnector grpc_status_code=OK http_endpoint="POST /v1/connectors" request_id=b0f5e1f7-5965-4b61-84e5-13401db1ea5f
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x10d6bf3]
goroutine 27 [running]:
github.com/conduitio/conduit/pkg/web/api/fromproto.ConnectorConfig(...)
/app/pkg/web/api/fromproto/connector.go:35
github.com/conduitio/conduit/pkg/web/api.(*ConnectorAPIv1).CreateConnector(0x3?, {0x2c04508?, 0xc0004728a0?}, 0x0?)
/app/pkg/web/api/connector_v1.go:97 +0x73
github.com/conduitio/conduit/proto/api/v1._ConnectorService_CreateConnector_Handler.func1({0x2c04508, 0xc0004728a0}, {0x14eea40?, 0xc000672a20})
/app/proto/api/v1/api_grpc.pb.go:566 +0x78
Version
{ "version": "v0.3.0-nightly.20220614-dirty", "os": "linux", "arch": "amd64" }
This is only a problem when issued via API calls. If someone is automating Conduit, then this becomes more of an issue. Currently, we know the Meroxa team is the only one automating Conduit. If more developers are running into this, we can bump this up in priority.