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

Failed to load remote context #56

Open
MPParsley opened this issue Jan 17, 2023 · 1 comment
Open

Failed to load remote context #56

MPParsley opened this issue Jan 17, 2023 · 1 comment

Comments

@MPParsley
Copy link

When consuming an LDES I sometimes run into this error: Failed to load remote context

2023-01-17T20:23:45.067Z [EventStream] info: 200 https://apidg.gent.be/opendata/adlib2eventstream/v1/hva/objecten?generatedAtTime=2023-01-06T18:44:49.883Z (840) ms
node:events:505
throw er; // Unhandled 'error' event
^
ErrorCoded: Failed to load remote context https://apidg.gent.be/opendata/adlib2eventstream/v1/context/generiek-basis.jsonld: request to https://apidg.gent.be/opendata/adlib2eventstream/v1/context/generiek-basis.jsonld failed, reason: socket hang up
at ContextParser.load (/usr/src/build/node_modules/jsonld-context-parser/lib/ContextParser.js:705:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Promise.all (index 4)
at async ContextParser.parse (/usr/src/build/node_modules/jsonld-context-parser/lib/ContextParser.js:595:30)
at async EntryHandlerKeywordContext.handle (/usr/src/build/node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordContext.js:33:46)
at async JsonLdParser.newOnValueJob (/usr/src/build/node_modules/jsonld-streaming-parser/lib/JsonLdParser.js:194:21)
at async JsonLdParser.executeBufferedJobs (/usr/src/build/node_modules/jsonld-streaming-parser/lib/JsonLdParser.js:400:21)
Emitted 'error' event on JsonLdParser instance at:
at JsonLdParser.onerror (/usr/src/build/node_modules/readable-stream/lib/internal/streams/readable.js:720:14)
at JsonLdParser.emit (node:events:527:28)
at emitErrorNT (/usr/src/build/node_modules/readable-stream/lib/internal/streams/destroy.js:150:8)
at emitErrorCloseNT (/usr/src/build/node_modules/readable-stream/lib/internal/streams/destroy.js:113:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'loading remote context failed'
}

Probably the server caused the socket hang up but the error isn't handled.
It's this module that throws the error but the problem is likely higher in the stack.

% curl -I https://apidg.gent.be/opendata/adlib2eventstream/v1/context/generiek-basis.jsonld | grep Cache
Cache-Control: public, max-age=86400
Cache-control: private

The context file should be cached, does this module support that?

@rubensworks
Copy link
Owner

The socket hangup is probably a server issue, for which you should attach an error-listener to the stream.

Currently, this tool doesn't support context caching, but this is something that could be achieved by passing your own document loader. Definitely open to a PR that enables context caching though :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants