pitaj / nodebb-plugin-calendar

Fully-featured calendar plugin for NodeBB
42 stars 34 forks source link

Not compatible with NodeBB v2.1.0 #152

Closed pooriamehregan closed 2 years ago

pooriamehregan commented 2 years ago

The calendar does not appear after NodeBB upgrade.

Screenshot from calendar page

pitaj commented 2 years ago

Upgrade from what version? What version of the calendar plugin are you on?

pooriamehregan commented 2 years ago

I upgraded NodeBB from 1.19.3 to 2.0.1 at first, and then to 2.1.0, and followed the instruction in the README.md file (npm install nodebb-plugin-calendar@latest) , so first i tried calendar 1.1.3, then 1.2.0., and at last 1.2.1, but neither of these versions of calendar did work with either of those versions of NodeBB (2.0.1 and 2.1.0). I also tried to install the calendar through ACP "Plugins" page. That did't work either. Temporary solution: I went back to using NodeBB 1.19.3 with nodebb-plugin-calendar@1.1.3. With this solution I have to turn off the audit check for it to work.

pitaj commented 2 years ago

And you rebuilt and restarted after installing the new plugin version?

pooriamehregan commented 2 years ago

Yes, both from the ACP and manually from the terminal.

pitaj commented 2 years ago

What language do you have set? Are there any errors in the browser console?

pooriamehregan commented 2 years ago

NodeBB version: 2.1.1 Calendar version: latest

The language in use is Norwegian, and errors in console are the following:

image

pitaj commented 2 years ago

Looks like your site is having trouble loading the entire script bundle. The error you show isn't caused by the calendar plugin.

Try running ./nodebb build from the command line. Are there any errors when you do so?

pooriamehregan commented 2 years ago

Appriciate you taking the time to respond and follow this issue. The console log is the following:


2022-06-14T07:58:57.522Z [4567/202] - info: [build]         plugin static dirs  build started
2022-06-14T07:58:57.524Z [4567/202] - info: [build]          requirejs modules  build started
2022-06-14T07:58:57.525Z [4567/202] - info: [build]           client js bundle  build started
2022-06-14T07:58:57.526Z [4567/202] - info: [build]            admin js bundle  build started
2022-06-14T07:58:57.526Z [4567/202] - info: [build]         client side styles  build started
2022-06-14T07:58:57.526Z [4567/202] - info: [build] admin control panel styles  build started
2022-06-14T07:58:57.527Z [4567/202] - info: [build]                  templates  build started
2022-06-14T07:58:57.527Z [4567/202] - info: [build]                  languages  build started
2022-06-14T07:58:57.885Z [4567/202] - info: [build]         plugin static dirs  build completed in 0.363sec
2022-06-14T07:58:58.344Z [4567/202] - info: [build]            admin js bundle  build completed in 0.818sec
2022-06-14T07:58:58.344Z [4567/202] - info: [build]           client js bundle  build completed in 0.819sec
2022-06-14T07:58:58.937Z [4567/202] - warn: [meta/templates] Partial not loaded: 500-embed.tpl
2022-06-14T07:58:59.754Z [4567/202] - warn: [meta/templates] Partial not loaded: partials/topic/browsing-users.tpl
2022-06-14T07:58:59.815Z [4567/202] - info: [build]                  languages  build completed in 2.288sec
2022-06-14T07:59:00.056Z [4567/202] - info: [build]                  templates  build completed in 2.529sec
2022-06-14T07:59:00.099Z [4567/202] - info: [build]          requirejs modules  build completed in 2.575sec
2022-06-14T07:59:01.392Z [4567/202] - info: [build]         client side styles  build completed in 3.865sec
2022-06-14T07:59:01.482Z [4567/202] - info: [build] admin control panel styles  build completed in 3.956sec
2022-06-14T07:59:01.482Z [4567/202] - info: [build] Bundling with Webpack.
313 assets
854 modules

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  03371bf1d5cbb1eab58e3a0130d1e9c2.js (491 KiB)
  nodebb.min.js (1.27 MiB)
  admin.min.js (1.15 MiB)
  8522.cdcc8def9cd723926fd3.min.js (471 KiB)
  4793.874eeda7b33b3d945f82.min.js (455 KiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  nodebb (1.27 MiB)
      nodebb.min.js
  admin (1.15 MiB)
      admin.min.js

webpack 5.72.1 compiled with 2 warnings in 19523 ms
2022-06-14T07:59:21.420Z [4567/202] - info: [build] Asset compilation successful. Completed in 23.895sec.
pitaj commented 2 years ago

Hmm that appeared to work fine. Assuming you still have the issue after a restart:

It's trying to load from localhost:4567. Are you currently running locally? Do you see nodebb.min.js in public/build?

What is your URL in config.json ? Does it match?

spongybob2 commented 2 years ago

I installed this plugin and could not get it work - nodebb v2.2. The plugin seems to be activated, rebuilt and restarted nodebb, but there's no calendar icon in the composer toolbar - is that where it is supposed to be? Also when i navigate to /calendar there's only one unstyled button with the text" Show only "Yes" .

pitaj commented 2 years ago

Are there any errors in the browser console? Please try following the same debug steps above.

spongybob2 commented 2 years ago

Sorry i'm new to nodebb and need to learn. Found an error in the console: Cannot read properties of undefined (reading 'template'). I could trace it to the function calendarLoad in src/client/index.ts

pitaj commented 2 years ago

Please post the full error text including stack trace.

Are there any errors when you build from the command line?

spongybob2 commented 2 years ago

No error from the build.

It's a browser side issue with lots of minified code, eval statements etc... but here's the console's log. Is there a better way to debug this code?

localhost/:45          GET http://0.0.0.0:4567/assets/plugins/nodebb-plugin-emoji/emoji/styles.css?v=4h4e0jscv5r net::ERR_FAILED
sockets.js:251 You are accessing the forum from an unknown origin. This will likely result in websockets failing to connect. 
To fix this, set the `"url"` value in `config.json` to the URL at which you access the site. 
For more information, see this FAQ topic: https://community.nodebb.org/topic/13388
eval @ sockets.js:251
eval @ sockets.js:257
./build/public/src/sockets.js @ nodebb.min.js?v=4h4e0jscv5r:389
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
eval @ app.js:16
./build/public/src/app.js @ nodebb.min.js?v=4h4e0jscv5r:50
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
eval @ client.js:3
./build/public/src/client.js @ nodebb.min.js?v=4h4e0jscv5r:61
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
(anonymous) @ nodebb.min.js?v=4h4e0jscv5r:1683
(anonymous) @ nodebb.min.js?v=4h4e0jscv5r:1685
DevTools failed to load source map: Could not load content for webpack://nodebb/node_modules/jquery-form/dist/jquery.form.min.js.map: Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://nodebb/node_modules/zxcvbn/lib/main.js.map: Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://nodebb/node_modules/zxcvbn/lib/matching.js.map: Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://nodebb/node_modules/zxcvbn/lib/frequency_lists.js.map: Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://nodebb/node_modules/zxcvbn/lib/adjacency_graphs.js.map: Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://nodebb/node_modules/zxcvbn/lib/scoring.js.map: Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://nodebb/node_modules/zxcvbn/lib/time_estimates.js.map: Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://nodebb/node_modules/zxcvbn/lib/feedback.js.map: Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://nodebb/build/public/client.js.map: Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
scripts-client.js?:formatted:2989 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'template')
    at e (scripts-client.js?:formatted:2989:26)
    at eval (scripts-client.js?:formatted:2997:178)
e @ scripts-client.js?:formatted:2989
eval @ scripts-client.js?:formatted:2997
Promise.then (async)
eval @ scripts-client.js?:formatted:2999
mightThrow @ jquery.js:3766
process @ jquery.js:3834
setTimeout (async)
eval @ jquery.js:3872
fire @ jquery.js:3500
fireWith @ jquery.js:3630
fire @ jquery.js:3638
fire @ jquery.js:3500
fireWith @ jquery.js:3630
ready @ jquery.js:4110
setTimeout (async)
eval @ jquery.js:4131
eval @ jquery.js:28
eval @ jquery.js:40
./node_modules/jquery/dist/jquery.js @ nodebb.min.js?v=4h4e0jscv5r:713
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
eval @ app.js:3
./build/public/src/app.js @ nodebb.min.js?v=4h4e0jscv5r:50
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
eval @ client.js:3
./build/public/src/client.js @ nodebb.min.js?v=4h4e0jscv5r:61
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
(anonymous) @ nodebb.min.js?v=4h4e0jscv5r:1683
(anonymous) @ nodebb.min.js?v=4h4e0jscv5r:1685
app.js:386 ServiceWorker registration succeeded.
websocket.js:62 WebSocket connection to 'ws://localhost:4567/socket.io/?EIO=4&transport=websocket&sid=By9X_Eal9Y9VS6r4AAAl' failed: 
doOpen @ websocket.js:62
open @ transport.js:57
probe @ socket.js:291
onOpen @ socket.js:313
onHandshake @ socket.js:370
onPacket @ socket.js:332
Emitter.emit @ index.mjs:140
onPacket @ transport.js:114
callback @ polling.js:133
onData @ polling.js:136
Emitter.emit @ index.mjs:140
onLoad @ polling.js:388
xhr.onreadystatechange @ polling.js:323
polling.js:334          POST http://localhost:4567/socket.io/?EIO=4&transport=polling&t=O6FAuDD&sid=By9X_Eal9Y9VS6r4AAAl 400 (Bad Request)
create @ polling.js:334
Request @ polling.js:276
request @ polling.js:226
doWrite @ polling.js:236
eval @ polling.js:181
eval @ index.js:19
encodePacket @ encodePacket.browser.js:33
eval @ index.js:16
encodePayload @ index.js:14
write @ polling.js:180
send @ transport.js:81
flush @ socket.js:420
sendPacket @ socket.js:504
write @ socket.js:465
_packet @ manager.js:285
packet @ socket.js:185
onopen @ socket.js:200
Emitter.emit @ index.mjs:140
onopen @ manager.js:206
eval @ manager.js:144
Emitter.emit @ index.mjs:140
onOpen @ socket.js:302
onHandshake @ socket.js:370
onPacket @ socket.js:332
Emitter.emit @ index.mjs:140
onPacket @ transport.js:114
callback @ polling.js:133
onData @ polling.js:136
Emitter.emit @ index.mjs:140
onLoad @ polling.js:388
xhr.onreadystatechange @ polling.js:323
XMLHttpRequest.send (async)
create @ polling.js:334
Request @ polling.js:276
request @ polling.js:226
doPoll @ polling.js:252
poll @ polling.js:112
doOpen @ polling.js:66
open @ transport.js:57
open @ socket.js:172
Socket @ socket.js:110
open @ manager.js:137
Manager @ manager.js:66
lookup @ index.js:41
eval @ sockets.js:20
eval @ sockets.js:257
./build/public/src/sockets.js @ nodebb.min.js?v=4h4e0jscv5r:389
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
eval @ app.js:16
./build/public/src/app.js @ nodebb.min.js?v=4h4e0jscv5r:50
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
eval @ client.js:3
./build/public/src/client.js @ nodebb.min.js?v=4h4e0jscv5r:61
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
(anonymous) @ nodebb.min.js?v=4h4e0jscv5r:1683
(anonymous) @ nodebb.min.js?v=4h4e0jscv5r:1685
polling.js:334          GET http://localhost:4567/socket.io/?EIO=4&transport=polling&t=O6FAuDE&sid=By9X_Eal9Y9VS6r4AAAl 400 (Bad Request)
create @ polling.js:334
Request @ polling.js:276
request @ polling.js:226
doPoll @ polling.js:252
poll @ polling.js:112
onData @ polling.js:143
Emitter.emit @ index.mjs:140
onLoad @ polling.js:388
xhr.onreadystatechange @ polling.js:323
XMLHttpRequest.send (async)
create @ polling.js:334
Request @ polling.js:276
request @ polling.js:226
doPoll @ polling.js:252
poll @ polling.js:112
doOpen @ polling.js:66
open @ transport.js:57
open @ socket.js:172
Socket @ socket.js:110
open @ manager.js:137
Manager @ manager.js:66
lookup @ index.js:41
eval @ sockets.js:20
eval @ sockets.js:257
./build/public/src/sockets.js @ nodebb.min.js?v=4h4e0jscv5r:389
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
eval @ app.js:16
./build/public/src/app.js @ nodebb.min.js?v=4h4e0jscv5r:50
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
eval @ client.js:3
./build/public/src/client.js @ nodebb.min.js?v=4h4e0jscv5r:61
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
(anonymous) @ nodebb.min.js?v=4h4e0jscv5r:1683
(anonymous) @ nodebb.min.js?v=4h4e0jscv5r:1685
DevTools failed to load source map: Could not load content for webpack://nodebb/build/public/src/modules/emoji.js.map: Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://nodebb/node_modules/pulling/build/pulling-drawer.js.map: Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
hooks.js:34 [hooks] Changes to hooks on this page …
polling.js:334          POST http://localhost:4567/socket.io/?EIO=4&transport=polling&t=O6FAvRr&sid=By9X_Eal9Y9VS6r4AAAl 400 (Bad Request)
create @ polling.js:334
Request @ polling.js:276
request @ polling.js:226
doWrite @ polling.js:236
eval @ polling.js:181
eval @ index.js:19
encodePacket @ encodePacket.browser.js:33
eval @ index.js:16
encodePayload @ index.js:14
write @ polling.js:180
close @ polling.js:158
doClose @ polling.js:162
close @ transport.js:68
onClose @ socket.js:574
onError @ socket.js:557
Emitter.emit @ index.mjs:140
onError @ transport.js:46
eval @ polling.js:242
Emitter.emit @ index.mjs:140
onError @ polling.js:356
eval @ polling.js:329
setTimeout (async)
xhr.onreadystatechange @ polling.js:328
XMLHttpRequest.send (async)
create @ polling.js:334
Request @ polling.js:276
request @ polling.js:226
doWrite @ polling.js:236
eval @ polling.js:181
eval @ index.js:19
encodePacket @ encodePacket.browser.js:33
eval @ index.js:16
encodePayload @ index.js:14
write @ polling.js:180
send @ transport.js:81
flush @ socket.js:420
sendPacket @ socket.js:504
write @ socket.js:465
_packet @ manager.js:285
packet @ socket.js:185
onopen @ socket.js:200
Emitter.emit @ index.mjs:140
onopen @ manager.js:206
eval @ manager.js:144
Emitter.emit @ index.mjs:140
onOpen @ socket.js:302
onHandshake @ socket.js:370
onPacket @ socket.js:332
Emitter.emit @ index.mjs:140
onPacket @ transport.js:114
callback @ polling.js:133
onData @ polling.js:136
Emitter.emit @ index.mjs:140
onLoad @ polling.js:388
xhr.onreadystatechange @ polling.js:323
XMLHttpRequest.send (async)
create @ polling.js:334
Request @ polling.js:276
request @ polling.js:226
doPoll @ polling.js:252
poll @ polling.js:112
doOpen @ polling.js:66
open @ transport.js:57
open @ socket.js:172
Socket @ socket.js:110
open @ manager.js:137
Manager @ manager.js:66
lookup @ index.js:41
eval @ sockets.js:20
eval @ sockets.js:257
./build/public/src/sockets.js @ nodebb.min.js?v=4h4e0jscv5r:389
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
eval @ app.js:16
./build/public/src/app.js @ nodebb.min.js?v=4h4e0jscv5r:50
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
eval @ client.js:3
./build/public/src/client.js @ nodebb.min.js?v=4h4e0jscv5r:61
__webpack_require__ @ nodebb.min.js?v=4h4e0jscv5r:1404
(anonymous) @ nodebb.min.js?v=4h4e0jscv5r:1683
(anonymous) @ nodebb.min.js?v=4h4e0jscv5r:1685
manifest.webmanifest:1 Manifest: property 'start_url' ignored, should be same origin as document.
hooks.js:28 [hooks] Registered filter:notifications.load ({ notifications: notifs }) => new Promise((resolve) => {
        translator.toggleTimeagoShorthand(function () {
            for (let i = 0; i < notifs.length; i += 1) {
                notifs[i].timeago = $.timeago(new Date(…
pitaj commented 2 years ago

Did you notice this warning?

You are accessing the forum from an unknown origin. This will likely result in websockets failing to connect. 
To fix this, set the `"url"` value in `config.json` to the URL at which you access the site. 
For more information, see this FAQ topic: https://community.nodebb.org/topic/13388

I'd suggest checking out https://community.nodebb.org/topic/13388 it might help resolve the issue you're seeing.

spongybob2 commented 2 years ago

Thanks for the head-up. That was from a local installation - just trying to debug this issue.

I get the an error which i suspect comes for the same point on a properly configured environment (with javascritpt minification), where there's no websocket warning. Extract of the log there:

Uncaught (in promise) TypeError: ajaxify.data is undefined
    e nodebb.min.js:1479
    60175 nodebb.min.js:1490
    promise callback*60175/</</< nodebb.min.js:1490
    c nodebb.min.js:15934
    d nodebb.min.js:15943
    setTimeout handler*o/< nodebb.min.js:15951
    l nodebb.min.js:15806
    fireWith nodebb.min.js:15859
    fire nodebb.min.js:15863
    l nodebb.min.js:15806
    fireWith nodebb.min.js:15859
    ready nodebb.min.js:16027
    setTimeout handler*19755/< nodebb.min.js:16033
    19755 nodebb.min.js:14499
    19755 nodebb.min.js:14504
    o nodebb.min.js:26939
    3155 nodebb.min.js:2867
    o nodebb.min.js:26939
    <anonymous> nodebb.min.js:27697
    <anonymous> nodebb.min.js:27700
    <anonymous> nodebb.min.js:27701
pitaj commented 2 years ago

Have you tried disabling all other plugins? Try the persona theme if you aren't already using it.

spongybob2 commented 2 years ago

It's just this plugin (beside the default ones) and the persona theme

spongybob2 commented 2 years ago

It seems it has to do with the availability of ajaxify.data before is it populated with ajaxify.parseData() It all lies in client/index.ts. A quick fix would be:

diff --git a/src/client/index.ts b/src/client/index.ts
index 9be53d9..de4e19b 100644
--- a/src/client/index.ts
+++ b/src/client/index.ts
@@ -6,7 +6,7 @@ __webpack_public_path__ = `${config.relative_path}/assets/plugins/nodebb-plugin-
 jQuery.fn.size = jQuery.fn.size || function size(this: JQuery) { return this.length; };

 const calendarLoad = () => {
-  if (ajaxify.data.template.calendar) {
+  if (ajaxify.temple && ajaxify.data.template.calendar) {
     import('../calendar');

     $('#plugin-calendar-cal-event-display').modal({
pitaj commented 2 years ago

Yes I'm aware of the problem and I'm trying to get core devs to fix it on their end.

pitaj commented 2 years ago

Fixed by https://github.com/NodeBB/NodeBB/commit/b778e38c2b94772e5ac7b06db7c2f5dba098e284 A NodeBB patch version will be issued soon