EventStore / EventStore-Client-Dotnet

Dotnet Client SDK for the Event Store gRPC Client API written in C#
Other
140 stars 38 forks source link

Updating built-in projection `$by_correlation_id` corrupts it #243

Open JBBianchi opened 1 year ago

JBBianchi commented 1 year ago

When updating the built-in projection $by_correlation_id via the UI with the value:

{"correlationIdProperty":"subject"}

It works, and the logs show:

[    1,21,18:16:13.724,INF] Updating '"$by_correlation_id"' projection source to '"{\"correlationIdProperty\":\"subject\"}"' (Requested type is: 'null')

When using the GRPC method EventStoreProjectionManagementClient.UpdateAsync

await this.EventStoreProjectionManagementClient.UpdateAsync("$by_correlation_id", "{\"correlationIdProperty\":\"subject\"}", true, cancellationToken: cancellationToken);

the update is "successful" but it corrupts the projections (turns it into a "JS" projection):

[    1,20,18:22:36.724,INF] Updating '"$by_correlation_id"' projection source to '"{\"correlationIdProperty\":\"subject\"}"' (Requested type is: '"JS"')
[    1,20,18:22:36.773,ERR] The '"$by_correlation_id"' projection faulted due to '"Line 1: Unexpected token :"'

To Reproduce Steps to reproduce the behavior:

  1. Update the projection $by_correlation_id via GRPC
    await this.EventStoreProjectionManagementClient.UpdateAsync("$by_correlation_id", "{\"correlationIdProperty\":\"subject\"}", true, cancellationToken: cancellationToken);

Expected behavior The projection not to get corrupted/turned into a JS projection or to have the opportunity to select the "requested type" via GRPC.

Actual behavior The projection is turned to JS.

EventStore details

hayley-jean commented 1 year ago

Thank you for reporting this @JBBianchi !

At the moment, the gRPC clients do not support updating system projections

That being said, the server should not have accepted the update to the system projection's handler type. I've created an issue for that on the server here: https://github.com/EventStore/EventStore/issues/3751

I'm going to leave this issue open until the functionality to update a system projection is available in the dotnet gRPC client