Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization of HttpDataAddress removes "baseUrl" and "path" properties #3214

Closed
carlos-schmidt opened this issue Jun 22, 2023 · 6 comments
Closed
Labels
bug_report Suspected bugs, awaiting triage stale Open for x days with no activity triage all new issues awaiting classification

Comments

@carlos-schmidt
Copy link

carlos-schmidt commented Jun 22, 2023

Bug Report

Describe the Bug

When trying to send a (DSP) TransferRequestMessage, the serializer (JsonLdRemoteMessageSerializerImpl) compacts the DataDestination (line 58). This process removes the baseUrl and path properties.

As a result, the data provider returns an error because the baseUrl of the dataDestination is null.

Expected Behavior

Compacting with jsonld keeps baseUrl and path.

Observed Behavior

Compacting with jsonld didn't keep baseUrl and path.

Steps to Reproduce

Steps to reproduce the behavior:
Starting with a contractAgreement between a consumer and provider EDC

  1. Send a transfer request:
var dataDestination = HttpDataAddress.Builder.newInstance()
    .baseUrl("http://localhost:9191") // also tried with trailing /
    .path("testPath")
    .addAdditionalHeader(DATA_TRANSFER_API_KEY, apiKey) // tried without additional header too...
    .build();

var dataRequest = DataRequest.Builder.newInstance()
                .id(UUID.randomUUID().toString())
                .connectorAddress(providerUrl.toString())
                .protocol(DATASPACE_PROTOCOL_HTTP)
                .connectorId("consumer")
                .assetId(assetId)
                .dataDestination(dataSinkAddress)
                .managedResources(false)
                .contractId(agreementId)
                .build();

var transferRequest = TransferRequest.Builder.newInstance()
                .dataRequest(dataRequest)
                .build();

transferProcessManager.initiateConsumerRequest(transferRequest);
  1. Wait for messages between consumer and provider to be exchanged...
  2. Consumer console output:
DEBUG 2023-06-22T11:58:32.376927 TransferProcess 364b5db1-e8ca-4775-b93b-3c9e8567b5c4 is now in state INITIAL
DEBUG 2023-06-22T11:58:32.3779266 Process 364b5db1-e8ca-4775-b93b-3c9e8567b5c4 is now INITIAL
DEBUG 2023-06-22T11:58:32.4189381 TransferProcess 364b5db1-e8ca-4775-b93b-3c9e8567b5c4 is now in state PROVISIONING
DEBUG 2023-06-22T11:58:32.4199379 TransferProcess: ID 364b5db1-e8ca-4775-b93b-3c9e8567b5c4. Provisioning
DEBUG 2023-06-22T11:58:32.4209386 TransferProcess 364b5db1-e8ca-4775-b93b-3c9e8567b5c4 is now in state PROVISIONED
DEBUG 2023-06-22T11:58:32.4219378 TransferProcess 364b5db1-e8ca-4775-b93b-3c9e8567b5c4 is now in state REQUESTING
DEBUG 2023-06-22T11:58:32.4229382 TransferProcess: ID 364b5db1-e8ca-4775-b93b-3c9e8567b5c4. Send TransferRequestMessage to http://localhost:8282/dsp
DEBUG 2023-06-22T11:58:47.9772364 TransferProcess: ID 364b5db1-e8ca-4775-b93b-3c9e8567b5c4. Attempt #1 failed to Send TransferRequestMessage to http://localhost:8282/dsp. Cause: org.eclipse.edc.spi.http.EdcHttpClientException: Server response to Request{method=POST, url=http://localhost:8282/dsp/transfers/request, headers=[Content-Type:application/json, Authorization:{"region":"eu","audience":"http://localhost:8282/dsp","clientId":"anonymous"}]} was not su
ccessful but was 400: {"@context":{"@vocab":"https://w3id.org/edc/v0.0.1/ns/"},"@type":"https://w3id.org/dspace/v0.8/TransferError","https://w3id.org/dspace/v0.8/code":"400","https://w3id.org/dspace/v0.8/reason":["DataAddress of type HttpData must contain a valid baseUrl: null"]}
java.util.concurrent.CompletionException: org.eclipse.edc.spi.http.EdcHttpClientException: Server response to Request{method=POST, url=http://localhost:8282/dsp/transfers/request, headers=[Content-Type:application/json, Authorizat
ion:{"region":"eu","audience":"http://localhost:8282/dsp","clientId":"anonymous"}]} was not successful but was 400: {"@context":{"@vocab":"https://w3id.org/edc/v0.0.1/ns/"},"@type":"https://w3id.org/dspace/v0.8/TransferError","https://w3id.org/dspace/v0.8/code":"400","https://w3id.org/dspace/v0.8/reason":["DataAddress of type HttpData must contain a valid baseUrl: null"]}

Important part:

Server response to Request ... was not successful but was 400:
{
  "@context": {
     "@vocab":"https://w3id.org/edc/v0.0.1/ns/"
  },
  "@type":"https://w3id.org/dspace/v0.8/TransferError",
  "https://w3id.org/dspace/v0.8/code":"400",
  "https://w3id.org/dspace/v0.8/reason": [
    "DataAddress of type HttpData must contain a valid baseUrl: null"
  ]
}

Context Information

  • Used version: EDC v0.1.0

Detailed Description

The following shows the result of compact() inside TitaniumJsonLd.java, where baseUrl and path have been removed (somehow the additionalHeader was spared though)

Debugger output of document (TransferRequestMessage) and compacted:
grafik

Possible Implementation

Maybe I am missing an EDC module that is needed to serialize HttpDataAddress, or I am missing something else.

@carlos-schmidt carlos-schmidt added the bug Something isn't working label Jun 22, 2023
@github-actions
Copy link

Thanks for your contribution 🔥 We will take a look asap 🚀

@ndr-brt ndr-brt added bug_report Suspected bugs, awaiting triage and removed bug Something isn't working labels Jun 23, 2023
@ndr-brt
Copy link
Member

ndr-brt commented Jun 23, 2023

please update to 0.1.2 and try again, because we won't patch the 0.1.0

@ndr-brt ndr-brt added the triage all new issues awaiting classification label Jun 23, 2023
@carlos-schmidt
Copy link
Author

Tried with 0.1.2, same behaviour

@ndr-brt
Copy link
Member

ndr-brt commented Jun 23, 2023

about the point 1. you reported Send a transfer request:, that's not an api call, are you calling the manager directly? That's not supposed, please interact with your connector calling the management api.
The issue is likely related to the HttpDataAddress builder, that's an internal object and not supposed to be used to initiate transfers.

@github-actions
Copy link

github-actions bot commented Jul 8, 2023

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale Open for x days with no activity label Jul 8, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug_report Suspected bugs, awaiting triage stale Open for x days with no activity triage all new issues awaiting classification
Projects
None yet
Development

No branches or pull requests

2 participants