node-solid-server icon indicating copy to clipboard operation
node-solid-server copied to clipboard

500 error on read public document - NamedNode IRI "null" must be absolute.

Open timbl opened this issue 4 years ago • 11 comments

A strange obug. When the document is read by a webapp it gets a 500 error, but a simple curl gives 200.

$ curl -I https://solidos.solidcommunity.net/public/2021/10_example_data/example.ttl
HTTP/1.1 200 OK
X-Powered-By: solid-server/5.6.16
Vary: Accept, Authorization, Origin
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: Authorization, User, Location, Link, Vary, Last-Modified, ETag, Accept-Patch, Accept-Post, Updates-Via, Allow, WAC-Allow, Content-Length, WWW-Authenticate, MS-Author-Via, X-Powered-By
Allow: OPTIONS, HEAD, GET, PATCH, POST, PUT, DELETE
Link: <example.ttl.acl>; rel="acl", <example.ttl.meta>; rel="describedBy", <http://www.w3.org/ns/ldp#Resource>; rel="type"
WAC-Allow: user="read write append",public="read write append"
MS-Author-Via: SPARQL
Updates-Via: wss://solidos.solidcommunity.net
Content-Type: text/turtle; charset=utf-8
Content-Length: 2
ETag: W/"2-nOO9QiTIwXgNtWtBJezz8kv3SLc"
Date: Tue, 16 Nov 2021 23:45:39 GMT
Connection: keep-alive
Keep-Alive: timeout=5

but the same URI when fetched by mashlib gives 500

HTTP/1.1 500 Internal Server Error
X-Powered-By: solid-server/5.6.16
Access-Control-Allow-Origin: null
Vary: Accept, Authorization, Origin
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: Authorization, User, Location, Link, Vary, Last-Modified, ETag, Accept-Patch, Accept-Post, Updates-Via, Allow, WAC-Allow, Content-Length, WWW-Authenticate, MS-Author-Via, X-Powered-By
Allow: OPTIONS, HEAD, GET, PATCH, POST, PUT, DELETE
Link: <example.ttl.acl>; rel="acl", <example.ttl.meta>; rel="describedBy", <http://www.w3.org/ns/ldp#Resource>; rel="type"
Content-Type: text/plain; charset=utf-8
Content-Length: 39
ETag: W/"27-AVbkXABETaBBBb89giO49PTSQHQ"
Date: Tue, 16 Nov 2021 23:52:01 GMT
Connection: keep-alive
Keep-Alive: timeout=5

where it looks ss though the server log may look something like


0|solid  | 2021-11-16T23:32:33.227Z solid:server Error page because of: Error: NamedNode IRI "null" must be absolute.
0|solid  |     at new NamedNode (/Users/timbl/src/github.com/solid/node-solid-server/node_modules/rdflib/lib/named-node.js:64:13)
0|solid  |     at Object.namedNode (/Users/timbl/src/github.com/solid/node-solid-server/node_modules/rdflib/lib/factories/canonical-data-factory.js:150:12)
0|solid  |     at new ACLChecker (/Users/timbl/src/github.com/solid/node-solid-server/lib/acl-checker.js:31:74)
0|solid  |     at Function.createFromLDPAndRequest (/Users/timbl/src/github.com/solid/node-solid-server/lib/acl-checker.js:189:12)
0|solid  |     at allowHandler (/Users/timbl/src/github.com/solid/node-solid-server/lib/handlers/allow.js:47:21)
0|solid  | /Users/timbl/src/github.com/solid/node-solid-server/lib/handlers/allow.js:78
0|solid  |     const error = req.authError || await req.acl.getError(userId, mode)
0|solid  |                                                  ^
0|solid  | TypeError: Cannot read properties of undefined (reading 'getError')
0|solid  |     at allowHandler (/Users/timbl/src/github.com/solid/node-solid-server/lib/handlers/allow.js:78:50)

and the httop response body is

NamedNode IRI "null" must be absolute.

timbl avatar Nov 17 '21 08:11 timbl

Request headers which caused the fail:

GET /public/2021/10_example_data/example.ttl HTTP/1.1
Host: solidos.solidcommunity.net
Connection: keep-alive
sec-ch-ua: "Google Chrome";v="95", "Chromium";v="95", ";Not A Brand";v="99"
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
sec-ch-ua-platform: "macOS"
Accept: */*
Origin: null
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,fr;q=0.8
sec-gpc: 1

timbl avatar Nov 17 '21 08:11 timbl

I cannot reproduce the problem with https://solidos.solidcommunity.net/public/2021/10_example_data/example.ttl either directly or using a solidos webApp https://solidos.solidcommunity.net/browse.html image

bourgeoa avatar Nov 17 '21 09:11 bourgeoa

I actually got the error running it in file space file:///Users/timbl/src/github.com/solid/solidos/workspaces/solid-ui/Documentation/form-examples/demo.html I hope it isn't some effect of that!

timbl avatar Nov 17 '21 13:11 timbl

I suppose. If I try this It does work. https://htmlpreview.github.io/?https://github.com/solid/solid-ui/blob/form-browser-tests/Documentation/form-examples/demo.html

image

bourgeoa avatar Nov 17 '21 14:11 bourgeoa

My guess is that it is. File space will always send origin null and will never be able to login with the new auth. That's why, on Jackson's recommendation, I switched Data Kitchen from file space to localhost. Unfortunately, according to Aaron, localhost will also not work with OIDC flow so I need to re-do Data Kitchen to use the webapp+localhost.

On Wed, Nov 17, 2021 at 5:54 AM Tim Berners-Lee @.***> wrote:

I actually got the error running it in file space file:///Users/timbl/src/ github.com/solid/solidos/workspaces/solid-ui/Documentation/form-examples/demo.html I hope it isn't some effect of that!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/solid/node-solid-server/issues/1640#issuecomment-971603731, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKVJCJESNXEGSBHOGNEU57TUMOXYBANCNFSM5IGJ5TXQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jeff-zucker avatar Nov 17 '21 15:11 jeff-zucker

Here is a curl command which fails

curl 'https://testingsolidos.solidcommunity.net/profile/card'   -H 'Connection: keep-alive'   -H 'sec-ch-ua: "Google Chrome";v="95", "Chromium";v="95", ";Not A Brand";v="99"'   -H 'sec-ch-ua-mobile: ?0'   -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36'   -H 'sec-ch-ua-platform: "macOS"'   -H 'Accept: */*'   -H 'Origin: null'   -H 'Sec-Fetch-Site: cross-site'   -H 'Sec-Fetch-Mode: cors'   -H 'Sec-Fetch-Dest: empty'   -H 'Accept-Language: en-US,en;q=0.9,fr;q=0.8'   -H 'sec-gpc: 1'   --compressed

timbl avatar Nov 21 '21 13:11 timbl

Hah! Duh ... here is a curl command which does it

curl 'https://testingsolidos.solidcommunity.net/profile/card'  -H 'Origin: null'

Chrome sends Origin:null it seems if it i running from a file: origin. n Who knew?

timbl avatar Nov 21 '21 13:11 timbl

The docs did. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin

timbl avatar Nov 21 '21 13:11 timbl

What's the solution to this issue?

IshaanOhri avatar Feb 27 '22 20:02 IshaanOhri

@IshaanOhri - AFAIK the solution is when using local apps to access remote pods, serve the app from a localhost, not as a simple file://.

jeff-zucker avatar Feb 27 '22 21:02 jeff-zucker

I tried running it from localhost itself. In the network tab it shows 2 requests, first one has a response code of 302 and the other has a response code of 500. The origin in the first request is http://localhost:3000 while in the second one is null

image

image

IshaanOhri avatar Feb 28 '22 03:02 IshaanOhri