matrix-org / matrix-org/matrix-widget-api

Given example is not working

Open
#44 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
95
Forks
24
Avg merge
16h 16m
Merged PRs (30d)
1

Description

The given example given in https://github.com/matrix-org/matrix-widget-api/tree/master/examples/widget, gives 404 for api.js.
By replacing https://github.com/matrix-org/matrix-widget-api/blob/master/examples/widget/index.html#L50 with <script src="https://unpkg.com/matrix-widget-api@v0.1.0-beta.16/dist/api.min.js"></script>, I get the following errors when opening the Custom Widget:

 Action:notify_capabilities failed with message: The postMessage was unhandled generic-f65725513b138597c58f.bundle.js:77:8220
    value https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:77
    value https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:77
    value https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:77
    (Async: EventListener.handleEvent)
    value https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:77
    t https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:77
    value https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:79
    Tr https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:61
    oi https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:61
    unstable_runWithPriority https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:77
    Wt https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:61
    ii https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:61
    Wr https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:61
    zr https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:61
    Pi https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:61
    Di https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:61
    Qr https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:61
    Di https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:61
    render https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:69
    <anonymous> https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:79
    t https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:1
    <anonymous> https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:1
    <anonymous> https://scalar.vector.im/api/widgets/generic-f65725513b138597c58f.bundle.js:1

and

 Error: widgetId is not present in URL - cannot load widget
    assertParam https://my.homeserver.com/matrix-widget-api/examples/widget/utils.js:24
    <anonymous> https://my.homeserver.com/matrix-widget-api/examples/widget/index.html:59
utils.js:29:13
    handleError https://my.homeserver.com/matrix-widget-api/examples/widget/utils.js:29
    <anonymous> https://my.homeserver.com/matrix-widget-api/examples/widget/index.html:102

Would be great to have a working boilerplate to experiment with.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with examples/widget/index.html, especially the script reference near line 50 and the widget-loading code near lines 59 and 102; also read examples/widget/utils.js around lines 24 and 29. Open the Custom Widget example and inspect the reported 404, postMessage failure, and missing widgetId. Done means the example is a working boilerplate without these errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.