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

Error during transfering data via http-data-plane #191

Closed
Jens011203 opened this issue Oct 10, 2023 · 5 comments
Closed

Error during transfering data via http-data-plane #191

Jens011203 opened this issue Oct 10, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@Jens011203
Copy link

Bug Report

The provider connector fails to connect to the endpoint given by the consumer.

Describe the Bug

I want to transfer data via the http-data-plane. I can negotiate a contract and start the transfer. The transferprocess starts as aspected:

DEBUG 2023-10-10T07:16:00.689750214 TransferProcess 6831b5bd-e3d2-49c3-9867-31c20615b341 is now in state INITIAL
DEBUG 2023-10-10T07:16:01.244568756 TransferProcess 6831b5bd-e3d2-49c3-9867-31c20615b341 is now in state PROVISIONING
DEBUG 2023-10-10T07:16:01.247355506 TransferProcess: ID 6831b5bd-e3d2-49c3-9867-31c20615b341. Provisioning
DEBUG 2023-10-10T07:16:01.252211714 TransferProcess 6831b5bd-e3d2-49c3-9867-31c20615b341 is now in state PROVISIONED
DEBUG 2023-10-10T07:16:01.253795214 TransferProcess 6831b5bd-e3d2-49c3-9867-31c20615b341 is now in state STARTING
DEBUG 2023-10-10T07:16:01.256427589 TransferProcess: ID 6831b5bd-e3d2-49c3-9867-31c20615b341. Initiate data flow
DEBUG 2023-10-10T07:16:01.287385964 Transferring from HttpData to HttpData.
DEBUG 2023-10-10T07:16:01.289191089 Executing HTTP request: https://jsonplaceholder.typicode.com/users
DEBUG 2023-10-10T07:16:01.295907048 TransferProcess: ID 6831b5bd-e3d2-49c3-9867-31c20615b341. Send TransferStartMessage to http://company2:8282/api/dsp
DEBUG 2023-10-10T07:16:01.335402631 TransferProcess: ID 6831b5bd-e3d2-49c3-9867-31c20615b341. Send TransferStartMessage to http://company2:8282/api/dsp
DEBUG 2023-10-10T07:16:01.335895839 TransferProcess 6831b5bd-e3d2-49c3-9867-31c20615b341 is now in state STARTED

But when the actual data-transfer should happen, I get the following error message:

SEVERE 2023-10-10T07:16:17.025202638 Error writing HTTP data null to endpoint http://localhost:4000/api/consumer/store for request: Request{method=POST, url=http://localhost:4000/api/consumer/store}
java.net.ConnectException: Failed to connect to localhost/127.0.0.1:4000
        at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:297)

I start the transfer with the following POST:

curl --request POST \
  --url http://localhost:9192/api/management/v2/transferprocesses \
  --header 'Content-Type: application/json' \
  --header 'User-Agent: insomnia/8.1.0' \
  --header 'x-api-key: ApiKeyDefaultValue' \
  --data '{
        "@context": {
          "edc": "https://w3id.org/edc/v0.0.1/ns/"
        },
        "@type": "TransferRequestDto",
        "connectorId": "consumer",
        "connectorAddress": "http://company1:8282/api/dsp",
        "contractId": "YWdncmVnYXRlZERhdGE=:YWdncmVnYXRlZERhdGE=:MDdmYmY5ZTItMWM4Yy00NTEzLTk4NzEtZWY0Zjc5MGJiODBk",
        "assetId": "aggregatedData2",
        "protocol": "dataspace-protocol-http",
        "dataDestination": { 
          "type": "HttpData",
          "baseUrl": "http://localhost:4000/api/consumer/store"
        },
				"managedResources": true,
	 			"transferType": {
        "isFinite": true
    }
}'

The endpoint "http://localhost:4000/api/consumer/store" is reachable and should work for the transfer. What could be the problem here?

Expected Behavior

The data should be transfered

Steps to Reproduce

Steps to reproduce the behavior:

  1. Run the MVD locally
  2. Register Assets and Dataplane for Http-data-transfer
  3. Get Contractagreement
  4. Start Transfer
@Jens011203 Jens011203 added the bug Something isn't working label Oct 10, 2023
@Jens011203
Copy link
Author

Also the HttpDataSource appears to be failing to fetch data from the sample endpoint https://jsonplaceholder.typicode.com/users, as the returned content is null. @ndr-brt Do you have any insights regarding this issue?

@ndr-brt
Copy link
Member

ndr-brt commented Oct 12, 2023

your dataDestination value is telling the provider connector that the consumer is expecting the data to be pushed to an endpoint exposed at the url http://localhost:4000/api/consumer/store.
The error java.net.ConnectException: Failed to connect to localhost/127.0.0.1:4000 is telling us that there's no endpoint exposed on that port.

@Jens011203
Copy link
Author

That's somehow not the problem. I started the server in the terminal with the following command:

HTTP_SERVER_PORT=4000 java -jar http_request_logger/build/libs/http_request_logger-0.2.0.jar

The logs confirmed that the HTTP request server logger successfully started at port 4000, which is the expected behaviour. To further verify this, I tested it with the HTTP-push sample and indeed it functioned correctly.

However, when attempting to use it in the MVD, I get this error.

@ndr-brt
Copy link
Member

ndr-brt commented Oct 13, 2023

did you started the endpoint into the docker network? I don't think so, because otherwise the hostname won't be localhost. the MVD is running into a docker compose network, so every other service will need to do that as well

@Jens011203
Copy link
Author

Thank you for your help. I hadn't considered this. I'm going to close the issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants