Reading data from Pod results in 500 Error

I’m using inrupt’s JS libraries to handle data reads/writes to pods from a website. When I try to access data from a Pod on which I have read access to, all I get is a 401 followed by a 500 error, as you can see from this screenshot:


The code that triggers this error is:

let medicalSolidDataset = await getSolidDataset(resource, {fetch: fetch});

What am I doing wrong? I checked the permissions and they are OK, I have read/write access on the resource.

Hi @nicomedia,

I have noticed something similar when attempting to access authorized Resources in a NSS Pod when authenticated using a Pod Spaces (https://pod.inrupt.com) WebID. We have some thoughts as to the problem, but still have not nailed it down.

In your case, are you using a Pod Spaces or NNS (solidcommunity.net or inrupt.net) WebID for authentication?

Thanks,

Kevin

Hi, I’m trying to access a resource stored on a solidcommunity.net WebID from a Pod Spaces WebID(pod.inrupt.com).

That sounds like the same issue. We are currently investigating to identify the source, and will respond back here with the results.

1 Like

The error arises here in fetchFactory.js

async function makeAuthenticatedRequest(unauthFetch, accessToken, url, defaultRequestInit, dpopKey) {
    return unauthFetch(url, await buildAuthenticatedHeaders(url.toString(), accessToken, dpopKey, defaultRequestInit));
}

Hi. Can anyone help me?

I am using solidcommunity.net. I am storing data into pod as RDF turtle format but how can I get data from this turtle like data.ttl#16684153384751369174376715586 (data.ttl where my text document stored)

And also I am using “tripledoc” package for create and fetch document.

First up, a heads-up that Tripledoc is deprecated. Most of its ideas live on in solid-client.

Other than that, it might be helpful to look at the tutorial. I don’t know what data you’ve written, but you could read it something like

  const document = await fetchDocument(
    "https://yourpod.solidcommunity.net/data.ttl"
  );
  const yourThing = document.getSubject(
    "https://yourpod.solidcommunity.net/data.ttl#16684153384751369174376715586"
  );
  // Assuming you've written e.g. a foaf:name, i.e. your document contains something like
  // :16684153384751369174376715586 <http://xmlns.com/foaf/0.1/name> "Vincent"
  const name = yourThing.getString('http://xmlns.com/foaf/0.1/name')
1 Like

Yeah, I got my data as how you mentioned, but how can I retrieve #16684153384751369174376715586 this portion from my pod by searching in just data.ttl? I want this because everytime when I add note to the pod this(16684153384751369174376715586) value changes.

So my question is how can I retrieve just this (16684153384751369174376715586) without explicitly told like this to the getSubject “https://yourpod.solidcommunity.net/data.ttl#16684153384751369174376715586” ?

You’ll probably want to use one of the methods on TripleDocument, in particular findSubject (if you’re looking for just one) or findSubjects (if you’re looking for multiple).

1 Like

You can also do this with a construct query using something like Comunica @comunica/query-sparql-solid - npm.

const QueryEngine = require('@comunica/query-sparql-solid').QueryEngine;
const myEngine = new QueryEngine();

const quadStream = await myEngine.queryQuads(`
  CONSTRUCT WHERE {
      <...data.ttl#16684153384751369174376715586> ?p ?o
  }`, {
  sources: [...data.ttl], // Sets your data file as query source
  '@comunica/actor-http-inrupt-solid-client-authn:session': session,
});

// Consume results as an array (easier)
const bindings = await quadStream.toArray();
console.log(bindings[0].subject, bindings[0].predicate, bindings[0].object);
1 Like

Thank you @jeswr

Thank you @Vincent