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

Akkoma's posts cannot be received due to "Error processing request JSON-LD" #113

Open
ShadowJonathan opened this issue Mar 2, 2024 · 2 comments

Comments

@ShadowJonathan
Copy link

ShadowJonathan commented Mar 2, 2024

After some additional debugging logging, we figured out why a.gup.pe was not accepting posts from our instance, it replies with "Error processing request JSON-LD", which is defined here:

return res.status(500).send('Error processing request JSON-LD')

We're using Akkoma 3.11


The JSON we were trying to send to the inbox was the following;

Long JSON
{
    "@context": [
        "https://www.w3.org/ns/activitystreams",
        "https://cooltrans.men/schemas/litepub-0.1.jsonld",
        {
            "@language": "und"
        }
    ],
    "actor": "https://cooltrans.men/users/jo",
    "cc": [
        "https://www.w3.org/ns/activitystreams#Public"
    ],
    "context": "https://cooltrans.men/contexts/0443005c-aaf5-4557-b156-39087a5035d2",
    "directMessage": false,
    "id": "https://cooltrans.men/activities/1399b1f9-b48d-4790-b9ed-db6114011bff",
    "object": {
        "actor": "https://cooltrans.men/users/jo",
        "attachment": [],
        "attributedTo": "https://cooltrans.men/users/jo",
        "cc": [
            "https://www.w3.org/ns/activitystreams#Public"
        ],
        "content": "<span class=\"h-card\"><a class=\"u-url mention\" data-user=\"AfRIZEdbPmhJwgNVuC\" href=\"https://a.gup.pe/u/test\" rel=\"ugc\">@<span>test</span></a></span> A test post",
        "contentMap": {
            "en": "<span class=\"h-card\"><a class=\"u-url mention\" data-user=\"AfRIZEdbPmhJwgNVuC\" href=\"https://a.gup.pe/u/test\" rel=\"ugc\">@<span>test</span></a></span> A test post"
        },
        "context": "https://cooltrans.men/contexts/0443005c-aaf5-4557-b156-39087a5035d2",
        "conversation": "https://cooltrans.men/contexts/0443005c-aaf5-4557-b156-39087a5035d2",
        "id": "https://cooltrans.men/objects/2702435d-83fa-4b49-a18f-be4636ee3e8c",
        "published": "2024-03-02T13:11:10.574761Z",
        "sensitive": null,
        "source": {
            "content": "@test@a.gup.pe A test post",
            "mediaType": "text/plain"
        },
        "summary": "",
        "tag": [
            {
                "href": "https://a.gup.pe/u/test",
                "name": "@test@a.gup.pe",
                "type": "Mention"
            }
        ],
        "to": [
            "https://cooltrans.men/users/jo/followers",
            "https://a.gup.pe/u/test"
        ],
        "type": "Note"
    },
    "published": "2024-03-02T13:11:10.574683Z",
    "to": [
        "https://cooltrans.men/users/jo/followers",
        "https://a.gup.pe/u/test"
    ],
    "type": "Create"
}
@ShadowJonathan ShadowJonathan changed the title "Error processing request JSON-LD" when receiving posts from akkoma TypeError: Cannot use 'in' operator to search for '@context' Mar 2, 2024
@ShadowJonathan ShadowJonathan changed the title TypeError: Cannot use 'in' operator to search for '@context' Akkoma's @context cannot be resolved Mar 2, 2024
@ShadowJonathan ShadowJonathan changed the title Akkoma's @context cannot be resolved Akkoma's posts cannot be received due to "Error processing request JSON-LD" Mar 2, 2024
@ShadowJonathan
Copy link
Author

I've figured out whats happening.

With a normal akkoma install, it'll fail with the following error;

Uncaught:
jsonld.InvalidUrl: Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.
    at ContextResolver._fetchContext (/Users/j0j0/dev/activitypub-express/node_modules/jsonld/lib/ContextResolver.js:186:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ContextResolver._resolveRemoteContext (/Users/j0j0/dev/activitypub-express/node_modules/jsonld/lib/ContextResolver.js:117:34)
    at async ContextResolver.resolve (/Users/j0j0/dev/activitypub-express/node_modules/jsonld/lib/ContextResolver.js:50:22)
    at async api.process (/Users/j0j0/dev/activitypub-express/node_modules/jsonld/lib/context.js:87:20)
    at async api.expand (/Users/j0j0/dev/activitypub-express/node_modules/jsonld/lib/expand.js:214:17)
    at async jsonld.expand (/Users/j0j0/dev/activitypub-express/node_modules/jsonld/lib/jsonld.js:321:18)
    at async jsonld.compact (/Users/j0j0/dev/activitypub-express/node_modules/jsonld/lib/jsonld.js:171:16) {
  details: {
    code: 'invalid remote context',
    url: 'https://cooltrans.men/schemas/litepub-0.1.jsonld'
  }
}

However, fetching that content manually reveals that the content-type is not properly set, it says application/octet-stream.

Strongarming the reverse proxy to set it to application/json makes it work again.

@ShadowJonathan
Copy link
Author

This was tracked on akkoma's side with https://akkoma.dev/AkkomaGang/akkoma/issues/716, now closed and fixed with 3.12.0

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

1 participant