woutslabbinck / SolidEventSourcing

A pipeline to transform location data (gpx file format) to RDF data and publish them as an Event Source on Solid
MIT License
2 stars 2 forks source link

The `editMetadata` function throws an Error eventhough the metadata is edited. #16

Closed argahsuknesib closed 6 months ago

argahsuknesib commented 6 months ago

Hello,

I am using the editMetadata function in the LDES Replayer library to a Node Solid Server.

I get the error that something went wrong while patching the metadata, and throws and error and the app crashes. However, the metadata does get patched and it is shown in the log right after the error. Maybe the check with only 205, is kind of strict? Is it possible that there can be other HTTP status codes as a response?

Error in the console

2024-03-12T15:13:14.846Z [WEB API] info: Express is listening at http://localhost:3001
2024-03-12T15:13:15.850Z [WEB API] info: The Dataset that will be loaded: spo2.nt
2024-03-12T15:13:21.914Z [WEB API] info: Start sorting the observations in the dataset.
2024-03-12T15:13:21.933Z [WEB API] info: Finished sorting the observations in the dataset. Size: 270
2024-03-12T15:13:26.471Z [WEB API] info: We're going to replay ONE observation and its related information from the current pointer onwards: 0
2024-03-12T15:13:26.471Z [WEB API] info: That observation is: [object Object]
2024-03-12T15:13:26.474Z [WEB API] info: Retrieving metadata of LDESinLDP if it already exists.
(node:75770) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
2024-03-12T15:13:26.580Z [WEB API] info: Retrieving all related information to the Observation being replayed.
2024-03-12T15:13:26.580Z [WEB API] info: Calculating the optimal size of the buckets in the pod.
2024-03-12T15:13:26.581Z [WEB API] info: The amount of Resources per bucket is: 270
2024-03-12T15:13:26.581Z [WEB API] info: Resources per UUID: 2
2024-03-12T15:13:26.581Z [WEB API] info: Naive algorithm (SINGLE): Execution for 270 resources with a bucket size of 50
2024-03-12T15:13:26.615Z [LDESinLDP] info: LDES in LDP https://localhost:8443/agg/ already exists.
1
LDP Container created: https://localhost:8443/agg/1700814430000/
2024-03-12T15:13:26.654Z [editMetadata] error: Something went wrong when trying to patch the root. This MUST NOT HAPPEN
2024-03-12T15:13:26.654Z [editMetadata] error: Body that should have been inserted: INSERT DATA { _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/tree#GreaterThanOrEqualToRelation> .
_:b0 <https://w3id.org/tree#node> <https://localhost:8443/agg/1700814430000/> .
_:b0 <https://w3id.org/tree#path> <https://saref.etsi.org/core/hasTimestamp> .
_:b0 <https://w3id.org/tree#value> "2023-11-24T08:27:10.000Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<https://localhost:8443/agg/> <https://w3id.org/tree#relation> _:b0 .
}
2024-03-12T15:13:26.654Z [editMetadata] error: Patch applied successfully.

/home/kush/Code/RSP/test/LDES-in-SOLID-Semantic-Observations-Replay/engine/dist/util/Util.js:56
            throw new Error("Something went wrong when trying to patch the root");
                  ^

Error: Something went wrong when trying to patch the root
    at /home/kush/Code/RSP/test/LDES-in-SOLID-Semantic-Observations-Replay/engine/dist/util/Util.js:56:19
    at Generator.next (<anonymous>)
    at fulfilled (/home/kush/Code/RSP/test/LDES-in-SOLID-Semantic-Observations-Replay/engine/dist/util/Util.js:5:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.11.1

The relevant issue on the LDES replayer repository is: https://github.com/SolidLabResearch/LDES-in-SOLID-Semantic-Observations-Replay/issues/30

argahsuknesib commented 6 months ago

When doing a PATCH request to a resource, I get a 200 HTTP status code along with Patch applied successfully. I will create a patch to also allow 200 code to not throw the error.

argahsuknesib commented 6 months ago

Hello @woutslabbinck , please merge the request https://github.com/woutslabbinck/SolidEventSourcing/pull/17

woutslabbinck commented 6 months ago

Merged, though maybe the 2xx spectrum would have been better

argahsuknesib commented 6 months ago

I think that only 200, 201, 202, 205, 218 in the status codes make sense as a possible response and not the whole 2xx spectrum.