Skip to content

mastodon plugin - Function.prototype.apply was called on undefined #2

@sneakers-the-rat

Description

@sneakers-the-rat

Edit:

  • npm: 10.2.4
  • node: 21.4.0

Tried running the demo as described in README, only difference is that I ran it from the KoreografeyeDemo repo instead of this one as the base, got this traceback:

MASTODON_ACCESS_TOKEN=<ACCESS_TOKEN> npx pol --single out/mastodemo.ttl --keep -ddd
(node:9271) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
2024-01-08T19:40:23.288Z [Components.js] warn: Detected remote context lookup for 'https://linkedsoftwaredependencies.org/bundles/npm/koreografeye/^0.4.6/components/context.jsonld' in ./config.jsonld. This may indicate a missing or invalid dependency, incorrect version number, or an invalid context URL.
2024-01-08T19:40:23.312Z [Components.js] warn: Detected remote context lookup for 'https://linkedsoftwaredependencies.org/bundles/npm/koreografeye-mastodon/^1.1.1/components/context.jsonld' in ./config.jsonld. This may indicate a missing or invalid dependency, incorrect version number, or an invalid context URL.
[2024-01-08T11:40:24.769] [DEBUG] default - main subject: urn:uuid:C7A19613-4CE5-429B-B9D8-84DA391DAC98
[2024-01-08T11:40:24.770] [DEBUG] default - origin: file:///in/mastodemo.ttl
[2024-01-08T11:40:24.770] [DEBUG] default - main subject: urn:uuid:C7A19613-4CE5-429B-B9D8-84DA391DAC98
[2024-01-08T11:40:24.770] [DEBUG] default - origin: file:///in/mastodemo.ttl
[2024-01-08T11:40:24.771] [TRACE] default -
PREFIX pol: <https://www.example.org/ns/policy#>
PREFIX fno: <https://w3id.org/function/ontology#>

SELECT ?id ?policy ?executionTarget ?name ?value WHERE {
  ?id pol:policy ?policy .
  ?policy a fno:Execution .
  ?policy fno:executes ?executionTarget .
  OPTIONAL { ?policy ?name ?value . } .
}

[2024-01-08T11:40:24.811] [INFO] default - found policy http://example.org/MyDemoPolicy with target http://example.org/sendToMastodon
[2024-01-08T11:40:24.811] [INFO] default - found policy http://example.org/MyDemoPolicy with target http://example.org/sendToMastodon
[2024-01-08T11:40:24.812] [INFO] default - found policy http://example.org/MyDemoPolicy with target http://example.org/sendToMastodon
[2024-01-08T11:40:24.812] [INFO] default - found policy http://example.org/MyDemoPolicy with target http://example.org/sendToMastodon
[2024-01-08T11:40:24.812] [DEBUG] default - policies:
[2024-01-08T11:40:24.812] [DEBUG] default - {
  'http://example.org/MyDemoPolicy': {
    node: NamedNode { id: 'http://example.org/MyDemoPolicy' },
    path: 'none',
    policy: 'bc_0_b1_b0_b2_sk_0',
    target: 'http://example.org/sendToMastodon',
    args: {
      'http://www.w3.org/1999/02/22-rdf-syntax-ns#type': [NamedNode],
      'https://w3id.org/function/ontology#executes': [NamedNode],
      'http://example.org/baseurl': [Literal],
      'http://example.org/toot': [Literal]
    }
  }
}
2024-01-08T19:40:24.852Z [Components.js] error: Detected fatal error. Generated 'componentsjs-error-state.json' with more information.
TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function
    at $o (KoreografeyeDemo/node_modules/esm/esm.js:1:224377)
    at wu (KoreografeyeDemo/node_modules/esm/esm.js:1:227324)
    at Eu (KoreografeyeDemo/node_modules/esm/esm.js:1:227999)
    at Module.<anonymous> (KoreografeyeDemo/node_modules/esm/esm.js:1:295976)
    at n (KoreografeyeDemo/node_modules/esm/esm.js:1:279589)
    at Object.<anonymous> (KoreografeyeDemo/node_modules/koreografeye-mastodon/node_modules/@digitalbazaar/http-client/index.js:8:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)

Not attaching the componentsjs-error-state.json because I couldn't really make sense of it/scan it for PII, but can submit that if that would be helpful.

Noticed that that repo pins an old version of the package so i tried updating it to ^0.4.0 as in this one, but that just nuked the error messages and printed out the entire contents of some minified module when I ran it, but gave the same error at the bottom.

It sort of looks like that error is being thrown on the mere import of the @digitalbazaar/http-client which is a dep of the jsonld package:

>>> npm explain @digitalbazaar/http-client
@digitalbazaar/http-client@1.2.0
node_modules/@digitalbazaar/http-client
  @digitalbazaar/http-client@"^1.1.0" from jsonld@5.2.0
  node_modules/jsonld
    jsonld@"^5.x.x" from koreografeye@0.4.6
    node_modules/koreografeye
      koreografeye@"^0.4.0" from the root project
      koreografeye@"^0.4.0" from koreografeye-mastodon@1.1.1
      node_modules/koreografeye-mastodon
        koreografeye-mastodon@"^1.1.1" from the root project

Can't find the apply call it's referring to tho.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions