Closed qertis closed 1 year ago
Can't deduce anything specific from the logs besides that fetching failed for some reason, so my guess is that either the SPARQL endpoint is not reachable from the CSS container or the URL is incorrect.
Can't deduce anything specific from the logs besides that fetching failed for some reason, so my guess is that either the SPARQL endpoint is not reachable from the CSS container or the URL is incorrect.
Thanks. Could you pleasure to make any SPARQL endpoint for example?
I don't have a running instance but for our tests we use virtuoso which might help: https://github.com/CommunitySolidServer/CommunitySolidServer/blob/473902b85dce2123d847e6b4ffaac2e11a86178b/.github/workflows/npm-test.yml#L67-L72
Not working with virtuoso-opensource
Run falling:
2023-01-19 14:58:57 solid | oidc-provider WARNING: Unsupported Node.js runtime version. Use ^12.19.0, ^14.15.0, or ^16.13.0
2023-01-19 14:59:01 solid | 2023-01-19T11:59:01.385Z [Components.js] info: Initiating component discovery from /community-server/
2023-01-19 14:59:02 solid | 2023-01-19T11:59:02.737Z [Components.js] info: Discovered 158 component packages within 1296 packages
2023-01-19 14:59:02 solid | 2023-01-19T11:59:02.747Z [Components.js] info: Initiating component loading
2023-01-19 14:59:25 solid | 2023-01-19T11:59:25.170Z [Components.js] debug: Registered a module https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql without components.
2023-01-19 14:59:25 solid | 2023-01-19T11:59:25.342Z [Components.js] info: Registered 745 components
2023-01-19 14:59:25 solid | 2023-01-19T11:59:25.353Z [Components.js] info: Loaded configs
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.654Z [UnsecureWebSocketsProtocol] {Primary} warn: The chosen configuration includes Solid WebSockets API 0.1, which is unauthenticated.
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.658Z [UnsecureWebSocketsProtocol] {Primary} warn: This component will be removed from default configurations in future versions.
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.666Z [ContainerInitializer] {Primary} info: Initializing container http://localhost:3000/
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.690Z [ExtensionBasedMapper] {Primary} debug: Container filepath /community-server/templates/root/empty maps to URL http://localhost:3000/
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.699Z [ExtensionBasedMapper] {Primary} debug: Document /community-server/templates/root/empty/.acl maps to URL http://localhost:3000/.acl
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.716Z [ExtensionBasedMapper] {Primary} debug: Document /community-server/templates/root/empty/.meta maps to URL http://localhost:3000/.meta
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.728Z [MemoryResourceLocker] {Primary} debug: Acquiring lock for http://localhost:3000/.read
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.730Z [MemoryResourceLocker] {Primary} debug: Acquired lock for http://localhost:3000/.read. 1 locks active.
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.733Z [MemoryResourceLocker] {Primary} debug: Acquiring lock for http://localhost:3000/.write
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.735Z [MemoryResourceLocker] {Primary} debug: Acquired lock for http://localhost:3000/.write. 2 locks active.
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.736Z [MemoryResourceLocker] {Primary} debug: Released lock for http://localhost:3000/.read. 1 active locks remaining.
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.741Z [SingleRootIdentifierStrategy] {Primary} debug: Identifier http://localhost:3000/ is part of http://localhost:3000/
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.751Z [SparqlDataAccessor] {Primary} info: Sending SPARQL CONSTRUCT query to http://localhost:4000/sparql/: CONSTRUCT { ?s ?p ?o. }
2023-01-19 14:59:37 solid | WHERE { GRAPH <meta:http://localhost:3000/> { ?s ?p ?o. } }
2023-01-19 14:59:37 solid | (node:1) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
2023-01-19 14:59:37 solid | (Use `node --trace-warnings ...` to show where the warning was created)
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.949Z [SparqlDataAccessor] {Primary} error: SPARQL endpoint http://localhost:4000/sparql/ error: fetch failed
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.954Z [MemoryResourceLocker] {Primary} debug: Acquiring lock for http://localhost:3000/.read
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.955Z [MemoryResourceLocker] {Primary} debug: Acquired lock for http://localhost:3000/.read. 2 locks active.
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.958Z [MemoryResourceLocker] {Primary} debug: Released lock for http://localhost:3000/.write. 1 active locks remaining.
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.960Z [MemoryResourceLocker] {Primary} debug: Released lock for http://localhost:3000/.read. 0 active locks remaining.
2023-01-19 14:59:37 solid | 2023-01-19T11:59:37.962Z [AppRunner] {Primary} error: Could not start the server: fetch failed
2023-01-19 14:59:37 solid | Could not start the server
2023-01-19 14:59:37 solid | Cause: fetch failed
2023-01-19 14:59:37 solid | TypeError: fetch failed
2023-01-19 14:59:37 solid | at Object.fetch (node:internal/deps/undici/undici:11118:11)
2023-01-19 14:59:37 solid | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-01-19 14:59:37 solid | at async SparqlEndpointFetcher.handleFetchCall (/community-server/node_modules/fetch-sparql-endpoint/lib/SparqlEndpointFetcher.js:177:30)
2023-01-19 14:59:37 solid | at async SparqlEndpointFetcher.fetchTriples (/community-server/node_modules/fetch-sparql-endpoint/lib/SparqlEndpointFetcher.js:116:28)
2023-01-19 14:59:37 solid | at async SparqlDataAccessor.sendSparqlConstruct (/community-server/dist/storage/accessors/SparqlDataAccessor.js:281:53)
2023-01-19 14:59:37 solid | at async SparqlDataAccessor.getMetadata (/community-server/dist/storage/accessors/SparqlDataAccessor.js:66:24)
2023-01-19 14:59:37 solid | at async DataAccessorBasedStore.hasResource (/community-server/dist/storage/DataAccessorBasedStore.js:65:13)
2023-01-19 14:59:37 solid | at async runWithTimeout (/community-server/dist/util/locking/WrappedExpiringReadWriteLocker.js:51:24)
2023-01-19 14:59:37 solid | at async GreedyReadWriteLocker.withReadLock (/community-server/dist/util/locking/GreedyReadWriteLocker.js:35:20)
2023-01-19 14:59:37 solid | at async TemplatedResourcesGenerator.generateResource (/community-server/dist/pods/generate/TemplatedResourcesGenerator.js:107:73)
components.yaml
version: "3.8"
services:
solid:
image: 'solidproject/community-server'
platform: linux/amd64
container_name: 'solid'
environment:
- CSS_LOGGING_LEVEL=debug # remove in prod
ports:
- '3000:3000'
entrypoint:
- node
- bin/server.js
- -c
- config/sparql-endpoint-no-setup.json
- --sparqlEndpoint
- http://localhost:4000/sparql/
volumes:
- solid-config:/config
sparql-endpoint:
image: tenforce/virtuoso
platform: linux/amd64
environment:
SPARQL_UPDATE: true
ports:
- '4000:8890'
redis:
container_name: redis
image: redis:7.0.7
ports:
- '6379:6379'
command: ["redis-server", "--bind", "redis", "--port", "6379", "--maxmemory-policy", "noeviction"]
@joachimvh @qertis —
image: tenforce/virtuoso
You may want to switch to the "official" Docker image(s) made by OpenLink Software, creator and maintainer of Virtuoso...
@qertis can you try again while using Node 16.x? I noticed the fetch error messages don't get shown when using 18.
@qertis can you try again while using Node 16.x? I noticed the fetch error messages don't get shown when using 18.
I use official docker images with Node 18
@joachimvh @qertis —
image: tenforce/virtuoso
You may want to switch to the "official" Docker image(s) made by OpenLink Software, creator and maintainer of Virtuoso...
I tried this, but unsuccessful
I don't have a running instance but for our tests we use virtuoso which might help:
You can try it without docker compose and see bug again. Just try 3 commands:
SPARQL DOCKER:
docker run -d --name mysparql -p 127.0.0.1:8890:8890/tcp --expose 8890 --env DBA_PASSWORD=mysecret --platform linux/amd64 openlink/virtuoso-opensource-7
SOLID DOCKER
docker run --name sss --link mysparql -p 127.0.0.1:3000:3000/tcp --expose 3000 --env CSS_LOGGING_LEVEL=debug --platform linux/amd64 -it solidproject/community-server
And after into solid docker press:
node bin/server.js -c config/sparql-endpoint-no-setup.json --sparqlEndpoint http://127.0.0.1:8890/sparql
You see
The reported error suggests that Virtuoso is not running.
Are you able to confirm that http://127.0.0.1:8890/sparql is a live endpoint? Any web browser should be able to load that page. If limited to command line, you could curl -LI http://127.0.0.1:8890/sparql
If not, are you able to confirm that http://127.0.0.1:8890/conductor and/or http://127.0.0.1:8890/ are live? Again, any web browser should be able to connect, as should —
curl -LI http://127.0.0.1:8890/sparql
curl -LI http://127.0.0.1:8890/
Checking the content of the Virtuoso log (default is virtuoso.log
, alongside the default virtuoso.db
and virtuoso.ini
) may also reveal something helpful.
I use official docker images with Node 18
The reason that I ask is that in Node 18 there are some changes to how fetch
works which causes the error to be less clear. In Node 16 there should be a more clearer message describing why exactly the fetching failed.
My guess is still that the endpoint is simply not reachable from the CSS container like Ted suggests as well. The CI integration tests run for SPARQL and I just did a quick local test without Docker to make sure that a server can start with a SPARQL backend, so the problem has to be somewhere in the Docker setup. But it's not something I use often myself so I can't immediately tell you what might be wrong with your setup.
Following is a working example in docker compose
version: "3.8"
services:
virtuoso:
image: tenforce/virtuoso:latest
ports:
- 8890:8890
environment:
- SPARQL_UPDATE=true
volumes:
- virtuoso-data:/data
solid:
image: solidproject/community-server:edge
environment:
- CSS_LOGGING_LEVEL=debug
- CSS_CONFIG=@css:config/sparql-endpoint-no-setup.json
- CSS_SPARQL_ENDPOINT=http://virtuoso:8890/sparql
ports:
- 3000:3000
volumes:
virtuoso-data:
You can use the virtual network that compose creates to address services directly with their given names, and also its easier/less error prone to use the env variables variant for config setup when using docker, as demonstrated.
Managed to get it working with fuseki/secoresearch
as well, the sparql endpoints needs to bet set to /ds
instead of /ds/sparql
since the latter isn't used for updates, only queries. Also the ENABLE_UPDATE
env var needs to be set to true.
version: "3.8"
services:
fuseki:
image: secoresearch/fuseki
ports:
- 3030:3030
volumes:
- fuseki-data:/fuseki-base
environment:
- ENABLE_UPDATE=true
solid:
depends_on:
- fuseki
image: solidproject/community-server:edge
environment:
- CSS_LOGGING_LEVEL=debug
- CSS_CONFIG=@css:config/sparql-endpoint-no-setup.json
- CSS_SPARQL_ENDPOINT=http://fuseki:3030/ds
ports:
- 3000:3000
volumes:
fuseki-data:
@MisterTimn Thank you so much! You saved my week.
Environment
compose.yaml
SPARQL Endpoint
Output