silverbulletmd / silverbullet

The hackable notebook
https://silverbullet.md
MIT License
2.03k stars 140 forks source link

CORS request error in online version #850

Open jibweb opened 2 months ago

jibweb commented 2 months ago

The online version does not seem to work currently for me on Firefox 113.0.2

Booting SilverBullet client in Online Mode [boot.ts:8:10](https://silverbullet.md/web/boot.ts)
Running in read-only mode [boot.ts:14:12](https://silverbullet.md/web/boot.ts)
Service worker registered... [boot.ts:32:14](https://silverbullet.md/web/boot.ts)
DOMException: CSSStyleSheet.cssRules getter: Not allowed to access cross-origin stylesheet
    n admonition.ts:91
    W6 admonition.ts:90
    create util.ts:88
    create state.mjs:5
    create state.mjs:5
    create state.mjs:5
    mp state.mjs:5
    ls state.mjs:5
    create state.mjs:5
    Vw editor_state.ts:69
    init client.ts:181
[async.ts:99:12](https://silverbullet.md/lib/async.ts)
Uncaught TypeError: i.editorView is undefined
    ViewComponent editor_ui.tsx:78
    Preact 2
[editor_ui.tsx:78:6](https://silverbullet.md/web/editor_ui.tsx)
Uncaught (in promise) TypeError: this.client.editorView is undefined
    commandsUpdated client_system.ts:114
    emit event.ts:16
    buildAllCommands command.ts:58
[client_system.ts:114:8](https://silverbullet.md/web/client_system.ts)
Uncaught TypeError: t.editorView is undefined
    Fb editor_ui.tsx:25
zefhemel commented 2 months ago

Firefox is currently at version 124.0, so this is is 11 versions (months?) behind. SilverBullet does rely on some more recent web standards and perhaps this is what's causing it. Is it possible to upgrade to a more recent version?

jibweb commented 2 months ago

Thanks for the responsiveness ! I tried on Firefox 124.0.2 (on Ubuntu) and got a similar error:

Booting SilverBullet client in Online Mode [boot.ts:8:10](https://silverbullet.md/web/boot.ts)
Running in read-only mode [boot.ts:14:12](https://silverbullet.md/web/boot.ts)
DOMException: CSSStyleSheet.cssRules getter: Not allowed to access cross-origin stylesheet
    n admonition.ts:91
    W6 admonition.ts:90
    create util.ts:88
    create state.mjs:5
    create state.mjs:5
    create state.mjs:5
    mp state.mjs:5
    ls state.mjs:5
    create state.mjs:5
    Vw editor_state.ts:69
    init client.ts:181
[async.ts:99:12](https://silverbullet.md/lib/async.ts)
Uncaught TypeError: i.editorView is undefined
    ViewComponent editor_ui.tsx:79
    Preact 2
[editor_ui.tsx:79:8](https://silverbullet.md/web/editor_ui.tsx)
Service worker registered... [boot.ts:32:14](https://silverbullet.md/web/boot.ts)
Uncaught (in promise) TypeError: this.client.editorView is undefined
    commandsUpdated client_system.ts:114
    emit event.ts:16
    buildAllCommands command.ts:58
[client_system.ts:114:8](https://silverbullet.md/web/client_system.ts)
Uncaught TypeError: t.editorView is undefined
    Fb editor_ui.tsx:25
[editor_ui.tsx](https://silverbullet.md/web/editor_ui.tsx)

It's worth pointing out that I also tried on Firefox on Android (124.2.0) and it works fine there

jibweb commented 2 months ago

Also worth noting is that this does not happen when running the docker image locally, This instance opens and works fine on Firefox 124.

zefhemel commented 2 months ago

Hmm, this seems to error out on some recent code by @onespaceman (https://github.com/silverbulletmd/silverbullet/pull/786) to implement custom admonitions. I don't see this error myself, though, not in firefox either.

Do you have any space styles in your space? Does the same thing happen if you run SilverBullet on an empty space folder? Or on silverbullet.md itself?

CaffeineFueled1 commented 1 month ago

I have the same issue in FF 125.x on Ubuntu.

Running in read-only mode boot.ts:14:12
DOMException: CSSStyleSheet.cssRules getter: Not allowed to access cross-origin stylesheet
    a admonition.ts:91
    VR admonition.ts:90
    create util.ts:88
    create state.mjs:5
    create state.mjs:5
    create state.mjs:5
    Xc state.mjs:5
    r2 state.mjs:5
    create state.mjs:5
    $g editor_state.ts:69
    init client.ts:181
    async* boot.ts:23
    qr async.ts:98
    <anonymous> boot.ts:7
    <anonymous> boot.ts:51
async.ts:99:12
Uncaught TypeError: n.editorView is undefined
    ViewComponent editor_ui.tsx:80
    Preact 28
    render editor_ui.tsx:316
    init client.ts:178
    async* boot.ts:23
    qr async.ts:98
    <anonymous> boot.ts:7
    <anonymous> boot.ts:51
editor_ui.tsx:80:8
Uncaught (in promise) TypeError: this.client.editorView is undefined
    commandsUpdated client_system.ts:114
    emit event.ts:16
    buildAllCommands command.ts:58
    Q3 command.ts:27
    r async.ts:6
    setTimeout handler*ao/< async.ts:5
    apply command.ts:139
    setTimeout handler*apply command.ts:138
    addHook system.ts:61
    yf client_system.ts:121
    init client.ts:150
    async* boot.ts:23
    qr async.ts:98
    <anonymous> boot.ts:7
    <anonymous> boot.ts:51
client_system.ts:114:8
Service worker registered... boot.ts:32:14

I encounter this problem on my instance, and the official silverbullet.md. It works in Chrome (Vanilla, no extensions etc) and it works in FF in Troubleshoot Mode as well, which implies a problem with my FF setup. As soon as I disable the extension tridactyl-vim (navigating browser via Vim shortcuts) it is working again and it is reproducible on my end.

I hope it helps.

EDIT: I updated from 0.7.3 to 0.7.7 - no issues on the previous version + downgrade fixes the issue as well (0.7.6 seems to be affected too)