-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Internal Server Error when trying to resolve Actor #72
Comments
Please let me know the version of Fedify and Node.js you are using. |
@dahlia We're using |
I think this issue is related: digitalbazaar/jsonld.js#451 Specifically this comment digitalbazaar/jsonld.js#451 (comment) What is the reasoning behind using "manual" mode for redirects? Is that part of the JSON-LD spec for resolving contexts? |
This seems to not be an issue with Fedify, this stems from using Docker somehow... Both of these commands should not error
But, if I run these commands inside of docker - the first one will error If I run:
Then I get:
This is really weird behaviour and can be replicated by some members of our team, but not all! Is there an easy way to hardcode the values of this into the cache? |
That's indeed very strange!
The best way would be to implement your own context loader! E.g., import { fetchDocumentLoader, RemoteDocument } from "@fedify/fedify";
async function cachedContextLoader(url: string): Promise<RemoteDocument> {
if (url === "https://w3id.org/security/v1") {
return {
contextUrl: null,
documentUrl: url,
document: {
"@context": { ... }
}
};
}
return await fetchDocumentLoader(url);
}
const federation = new Federation<void>({
contextLoader: cachedContextLoader,
}); |
Hey @dahlia I've tried your suggestion but I'm still running into issues Here's what I've tried: const securityDoc = {
contextUrl: null,
documentUrl: 'https://w3id.org/security/v1',
document: {
"@context": {
...
}
}
};
import { fetchDocumentLoader, RemoteDocument, getAuthenticatedDocumentLoader } from "@fedify/fedify";
async function cachedContextLoader(url: string): Promise<RemoteDocument> {
if (url === "https://w3id.org/security/v1" || url === "https://w3id.org/security/v1/") {
return securityDoc;
}
return await fetchDocumentLoader(url);
}
const fedifyKv = new MemoryKvStore();
fedifyKv.set(['_fedify', 'remoteDocument', 'https://w3id.org/security/v1/'], securityDoc);
fedifyKv.set(['_fedify', 'remoteDocument', 'https://w3id.org/security/v1'], securityDoc);
const fedify = new Federation<ContextData>({
kv: fedifyKv,
contextLoader: cachedContextLoader,
documentLoader: cachedContextLoader,
authenticatedDocumentLoaderFactory: (identity) => {
const loader = getAuthenticatedDocumentLoader(identity);
return async function load(url) {
if (url === "https://w3id.org/security/v1" || url === "https://w3id.org/security/v1/") {
return securityDoc;
}
return await loader(url);
}
},
treatHttps: true
}); And I am getting this error when attempting to send activities to other actors
It's as if the context isn't always loaded through the document/context loader and is falling back to the default? Do you know what could be causing this? |
Looks like you've used |
@allouis Is your issue now resolved? Would it be okay if I close this issue? |
Sorry I missed this - yeah this is resolved now with the hardcoded contexts! |
I've configured the
Federation
instance to have an actor and keypair dispatcher like below (Currently I'm returningnull
for debugging purposes, but the error happens when I return a keypair, too)When I try to read the Actor data via curl like:
I get this error:
I then updated to only set an actor dispatcher like so:
And curling this gives the same error!
The text was updated successfully, but these errors were encountered: