trashhalo / obsidian-extract-url

Plugin to extract markdown out of urls
GNU General Public License v3.0
274 stars 12 forks source link

error running about building it by myself #27

Closed time4Wiley closed 1 year ago

time4Wiley commented 1 year ago

I want to cutomize this plugin.

What's the suggested build environment for it:

  1. Rust version
  2. Node version
  3. npm or yarn version

I tried to build, but it reports the following error message upon loading

plugin:extract-url-2:1394 wasm-bindgen: imported JS function that was not marked ascatch` threw an error: Cannot read properties of undefined (reading 'loadData')

Stack: TypeError: Cannot read properties of undefined (reading 'loadData') at eval (plugin:extract-url-2:1834:34) at logError (plugin:extract-url-2:1382:14) at imports.wbg.wbg_loadData_216184d2c1296582 (plugin:extract-url-2:1833:12) at obsidian_rust_plugin::settings::::load_data::h9d4f1ed7dece0504 (wasm://wasm/02a51386:wasm-function[14861]:0x72623c) at obsidian_rust_plugin::settings::load_settings::{{closure}}::h1424357f02345de1 (wasm://wasm/02a51386:wasm-function[796]:0x325951) at <core::future::from_generator::GenFuture as core::future::future::Future>::poll::h0f905cabe6f937ce (wasm://wasm/02a51386:wasm-function[3645]:0x51a0c7) at obsidian_rust_plugin::settings_internal::{{closure}}::h6328081e413d79e6 (wasm://wasm/02a51386:wasm-function[660]:0x2f29da) at <core::future::from_generator::GenFuture as core::future::future::Future>::poll::hf42da0a3dd0cb5f9 (wasm://wasm/02a51386:wasm-function[3648]:0x51a577) at obsidian_rust_plugin::settings::{{closure}}::hc944506d158613a0 (wasm://wasm/02a51386:wasm-function[496]:0x2a8b8f) at <core::future::from_generator::GenFuture as core::future::future::Future>::poll::hfcd12ac90448744c (wasm://wasm/02a51386:wasm-function[7481]:0x62b0ec) logError @ plugin:extract-url-2:1394 imports.wbg.wbg_loadData_216184d2c1296582 @ plugin:extract-url-2:1833 $obsidian_rust_plugin::settings::::load_data::h9d4f1ed7dece0504 @ 02a51386:0x72623c $obsidian_rust_plugin::settings::load_settings::{{closure}}::h1424357f02345de1 @ 02a51386:0x325951 $<core::future::from_generator::GenFuture as core::future::future::Future>::poll::h0f905cabe6f937ce @ 02a51386:0x51a0c7 $obsidian_rust_plugin::settings_internal::{{closure}}::h6328081e413d79e6 @ 02a51386:0x2f29da $<core::future::from_generator::GenFuture as core::future::future::Future>::poll::hf42da0a3dd0cb5f9 @ 02a51386:0x51a577 $obsidian_rust_plugin::settings::{{closure}}::hc944506d158613a0 @ 02a51386:0x2a8b8f $<core::future::from_generator::GenFuture as core::future::future::Future>::poll::hfcd12ac90448744c @ 02a51386:0x62b0ec $obsidian_rust_plugin::wasm_bindgen_generated_settingsconst::wasm_bindgen_generated_settings::{{closure}}::hf2a5a823346eb398 @ 02a51386:0x3bfcb9 $<core::future::from_generator::GenFuture as core::future::future::Future>::poll::h585b54e5b52d2b2c @ 02a51386:0x5b4395 $wasm_bindgen_futures::future_to_promise::{{closure}}::{{closure}}::h231ffbfbe76cee0c @ 02a51386:0x3b0b57 $<core::future::from_generator::GenFuture as core::future::future::Future>::poll::h287d1cf6ed0d809c @ 02a51386:0x62ad64 $wasm_bindgen_futures::task::singlethread::Task::run::h577348ec63aa197c @ 02a51386:0x4a1806 $wasm_bindgen_futures::queue::QueueState::run_all::hcb1481dfc5c1eda1 @ 02a51386:0x4e694c $wasm_bindgen_futures::queue::Queue::new::{{closure}}::hf3a5b3b6a4589e41 @ 02a51386:0x6cf380 $<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h83f13ee8b3dd9140 @ 02a51386:0x63f7e9 wbg_adapter_30 @ plugin:extract-url-2:1440 real @ plugin:extract-url-2:1416 Promise.then (async) eval @ plugin:extract-url-2:2025 logError @ plugin:extract-url-2:1382 imports.wbg.wbg_then_ce526c837d07b68f @ plugin:extract-url-2:2024 $js_sys::Promise::then::hb3b4bbcd17fca085 @ 02a51386:0x6fb81b $wasm_bindgen_futures::queue::Queue::push_task::h1ae7317925fa3a01 @ 02a51386:0x53f1be $wasm_bindgen_futures::task::singlethread::Task::wake_by_ref::{{closure}}::h4deb7b5189e70a6c @ 02a51386:0x72b71c $std::thread::local::LocalKey::try_with::hb1322c30e2ccd133 @ 02a51386:0x57cc5c $std::thread::local::LocalKey::with::hc4acb8dba5121a8b @ 02a51386:0x682df4 $wasm_bindgen_futures::task::singlethread::Task::wake_by_ref::hc9a3b1234dcfdeb2 @ 02a51386:0x64b93b $wasm_bindgen_futures::task::singlethread::Task::spawn::h859f450d771c51fd @ 02a51386:0x419755 $wasm_bindgen_futures::spawn_local::hcad5e11df0e5849c @ 02a51386:0x45023d $wasm_bindgen_futures::future_to_promise::{{closure}}::hdc41a188080a534f @ 02a51386:0x54c196 $wasm_bindgen::convert::closures::invoke2_mut::hb8b10e5895ee5777 @ 02a51386:0x60708d wbg_adapter_156 @ plugin:extract-url-2:1465 cb0 @ plugin:extract-url-2:2005 eval @ plugin:extract-url-2:2010 logError @ plugin:extract-url-2:1382 imports.wbg.wbg_new_37705eed627d5ed9 @ plugin:extract-url-2:1998 $js_sys::Promise::new::h170907816db7f856 @ 02a51386:0x6e97f3 $wasm_bindgen_futures::future_to_promise::hd93c849d4a9a2a53 @ 02a51386:0x58f7a3 $onload @ 02a51386:0x675955 onload @ plugin:extract-url-2:1455 onload @ plugin:extract-url-2:2132 await in onload (async) e.load @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 a @ app.js:1 Promise.then (async) l @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 e.loadPlugin @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 e.enablePlugin @ app.js:1 reload @ plugin:hot-reload:98 await in reload (async) requestReload @ plugin:hot-reload:83 eval @ plugin:hot-reload:112 setTimeout (async) eval @ plugin:hot-reload:112 onFileChange @ plugin:hot-reload:79 e.tryTrigger @ app.js:1 e.trigger @ app.js:1 t.trigger @ app.js:1 t.onChange @ app.js:1 e.trigger @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 e.reconcileFile @ app.js:1 (anonymous) @ app.js:1 n @ app.js:1 Promise.then (async) e.queue @ app.js:1 (anonymous) @ app.js:1 setTimeout (async) e.onFileChange @ app.js:1 (anonymous) @ app.js:1 emit @ node:events:390 FSWatcher._handle.onchange @ node:internal/original-fs/watchers:212 plugin:extract-url-2:1834 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'loadData') at eval (plugin:extract-url-2:1834:34) at logError (plugin:extract-url-2:1382:14) at imports.wbg.wbg_loadData_216184d2c1296582 (plugin:extract-url-2:1833:12) at obsidian_rust_plugin::settings::::load_data::h9d4f1ed7dece0504 (02a51386:0x72623c) at obsidian_rust_plugin::settings::load_settings::{{closure}}::h1424357f02345de1 (02a51386:0x325951) at <core::future::from_generator::GenFuture as core::future::future::Future>::poll::h0f905cabe6f937ce (02a51386:0x51a0c7) at obsidian_rust_plugin::settings_internal::{{closure}}::h6328081e413d79e6 (02a51386:0x2f29da) at <core::future::from_generator::GenFuture as core::future::future::Future>::poll::hf42da0a3dd0cb5f9 (02a51386:0x51a577) at obsidian_rust_plugin::settings::{{closure}}::hc944506d158613a0 (02a51386:0x2a8b8f) at <core::future::from_generator::GenFuture as core::future::future::Future>::poll::hfcd12ac90448744c (02a51386:0x62b0ec) eval @ plugin:extract-url-2:1834 logError @ plugin:extract-url-2:1382 imports.wbg.wbg_loadData_216184d2c1296582 @ plugin:extract-url-2:1833 $obsidian_rust_plugin::settings::::load_data::h9d4f1ed7dece0504 @ 02a51386:0x72623c $obsidian_rust_plugin::settings::load_settings::{{closure}}::h1424357f02345de1 @ 02a51386:0x325951 $<core::future::from_generator::GenFuture as core::future::future::Future>::poll::h0f905cabe6f937ce @ 02a51386:0x51a0c7 $obsidian_rust_plugin::settings_internal::{{closure}}::h6328081e413d79e6 @ 02a51386:0x2f29da $<core::future::from_generator::GenFuture as core::future::future::Future>::poll::hf42da0a3dd0cb5f9 @ 02a51386:0x51a577 $obsidian_rust_plugin::settings::{{closure}}::hc944506d158613a0 @ 02a51386:0x2a8b8f $<core::future::from_generator::GenFuture as core::future::future::Future>::poll::hfcd12ac90448744c @ 02a51386:0x62b0ec $obsidian_rust_plugin::wasm_bindgen_generated_settingsconst::wasm_bindgen_generated_settings::{{closure}}::hf2a5a823346eb398 @ 02a51386:0x3bfcb9 $<core::future::from_generator::GenFuture as core::future::future::Future>::poll::h585b54e5b52d2b2c @ 02a51386:0x5b4395 $wasm_bindgen_futures::future_to_promise::{{closure}}::{{closure}}::h231ffbfbe76cee0c @ 02a51386:0x3b0b57 $<core::future::from_generator::GenFuture as core::future::future::Future>::poll::h287d1cf6ed0d809c @ 02a51386:0x62ad64 $wasm_bindgen_futures::task::singlethread::Task::run::h577348ec63aa197c @ 02a51386:0x4a1806 $wasm_bindgen_futures::queue::QueueState::run_all::hcb1481dfc5c1eda1 @ 02a51386:0x4e694c $wasm_bindgen_futures::queue::Queue::new::{{closure}}::hf3a5b3b6a4589e41 @ 02a51386:0x6cf380 $<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h83f13ee8b3dd9140 @ 02a51386:0x63f7e9 wbg_adapter_30 @ plugin:extract-url-2:1440 real @ plugin:extract-url-2:1416 Promise.then (async) eval @ plugin:extract-url-2:2025 logError @ plugin:extract-url-2:1382 imports.wbg.wbg_then_ce526c837d07b68f @ plugin:extract-url-2:2024 $js_sys::Promise::then::hb3b4bbcd17fca085 @ 02a51386:0x6fb81b $wasm_bindgen_futures::queue::Queue::push_task::h1ae7317925fa3a01 @ 02a51386:0x53f1be $wasm_bindgen_futures::task::singlethread::Task::wake_by_ref::{{closure}}::h4deb7b5189e70a6c @ 02a51386:0x72b71c $std::thread::local::LocalKey::try_with::hb1322c30e2ccd133 @ 02a51386:0x57cc5c $std::thread::local::LocalKey::with::hc4acb8dba5121a8b @ 02a51386:0x682df4 $wasm_bindgen_futures::task::singlethread::Task::wake_by_ref::hc9a3b1234dcfdeb2 @ 02a51386:0x64b93b $wasm_bindgen_futures::task::singlethread::Task::spawn::h859f450d771c51fd @ 02a51386:0x419755 $wasm_bindgen_futures::spawn_local::hcad5e11df0e5849c @ 02a51386:0x45023d $wasm_bindgen_futures::future_to_promise::{{closure}}::hdc41a188080a534f @ 02a51386:0x54c196 $wasm_bindgen::convert::closures::invoke2_mut::hb8b10e5895ee5777 @ 02a51386:0x60708d wbg_adapter_156 @ plugin:extract-url-2:1465 cb0 @ plugin:extract-url-2:2005 eval @ plugin:extract-url-2:2010 logError @ plugin:extract-url-2:1382 imports.wbg.wbg_new_37705eed627d5ed9 @ plugin:extract-url-2:1998 $js_sys::Promise::new::h170907816db7f856 @ 02a51386:0x6e97f3 $wasm_bindgen_futures::future_to_promise::hd93c849d4a9a2a53 @ 02a51386:0x58f7a3 $onload @ 02a51386:0x675955 onload @ plugin:extract-url-2:1455 onload @ plugin:extract-url-2:2132 await in onload (async) e.load @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 a @ app.js:1 Promise.then (async) l @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 e.loadPlugin @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 e.enablePlugin @ app.js:1 reload @ plugin:hot-reload:98 await in reload (async) requestReload @ plugin:hot-reload:83 eval @ plugin:hot-reload:112 setTimeout (async) eval @ plugin:hot-reload:112 onFileChange @ plugin:hot-reload:79 e.tryTrigger @ app.js:1 e.trigger @ app.js:1 t.trigger @ app.js:1 t.onChange @ app.js:1 e.trigger @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 e.reconcileFile @ app.js:1 (anonymous) @ app.js:1 n @ app.js:1 Promise.then (async) e.queue @ app.js:1 (anonymous) @ app.js:1 setTimeout (async) e.onFileChange @ app.js:1 (anonymous) @ app.js:1 emit @ node:events:390 FSWatcher._handle.onchange @ node:internal/original-fs/watchers:212 `

time4Wiley commented 1 year ago

My mistake. I changed the plugin id, which makes the following code return null.

src/obsidian.rs 145: inline_js = "export function plugin() { return app.plugins.plugins['extract-url']; }"

trashhalo commented 1 year ago

Would you be willing to update the readme with what you found? Im sure that would help others