International-Data-Spaces-Association / DataspaceConnector

This is an IDS Connector reference implementation.
Apache License 2.0
34 stars 29 forks source link

DSC publishes old data on subscription (with workaround) #569

Open omarsilva1 opened 1 year ago

omarsilva1 commented 1 year ago

Describe the bug In case that a DSC has subscribed to its own artifact on update the subscriptions location receives the previous artifact data instead of the new data.

To Reproduce Steps to reproduce the behavior:

  1. Create an artifact
  2. Create a subscription and set the location and subscriber to webhook
  3. Update the artifact with new data using the endpoint POST /api/artifact/artifactId/data
  4. See that webhook receives the value before the update

Expected behavior The updated value should be dispatched to webhook.

omarsilva1 commented 1 year ago

There is a workaround for this bug. Updating only the value of the artifact leads to the aforementioned issue. However, if you update the whole artifact (using POST /api/artifact/{artifactId} with the request body containing the new value and the previous title and description) the correct value is sent.

The best way of updating an artifact value (so that it works with subscriptions)

PUT /api/artifacts/{id} HTTP/1.1
Content-Type: application/json

{
    "title": "Artifact Title",
    "description": "Artifact Description",
    "automatedDownload": false,
    "value": "new value"
}

It would be still interesting to know why POST /api/artifact/{artifactId}/data leads to the old data being sent.