What? UnhandledPromiseRejectionWarning

General Discussion
  • Trying to upgrade from 1.9.x to 2.4.0 but getting this.
    I can't afford to break the forums so figured I should ask directly as this is too important to try things I find on the Internet.

    I went back to the backup for now. Here is what shows then nothing more happens.

    at async Configs.list (/opt/nodebb/src/meta/configs.js:98:9)
    (Use node --trace-warnings ... to show where the warning was created)
    (node:155485) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().

    To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
    (node:155485) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

  • @NodeHam Please post the entire stack trace for the error you are getting. at async Configs.list (/opt/nodebb/src/meta/configs.js:98:9) is only part of the error message.

  • Hi, I restored the vm so all was lost as I wanted to get the server up again asap.

    Is the stack trace in the nodebb/logs or with the web server?

    I can try to upgrade again and this time, keep what ever shows up if it happens again.

  • @NodeHam It should be in logs/output.log in the nodebb folder.

  • I tried again and still having problems. Seems to be a warning however and maybe not a problem.

    Trying to go from 1.19.2 to 2.5.2. The strange thing is the that GUI shows it's running 2.5.2 now. Should I restore the backup I made before anyone posts something?

    These are the steps I took and the error that comes.

    systemctl stop nodebb
    tar -cvf /new/nodebb-9-19-2022.tar /opt/nodebb/
    mongodump -d nodebb -o /new/mongodump/nodebb-
    dnf update nodejs
    git fetch
    git checkout v2.x
    git reset --hard origin/v2.x
    ./nodebb upgrade

    Updating NodeBB...
    
    1. Updating package.json file with defaults...  OK
    
    2. Bringing base dependencies up to date...  started
    npm WARN @apidevtools/[email protected] requires a peer of openapi-types@>=7 but none is installed. You must install peer dependencies yourself.
    npm WARN [email protected] requires a peer of popper.js@^1.16.0 but none is installed. You must install peer dependencies yourself.
    npm WARN [email protected] requires a peer of textcomplete@^0.14.2 but none is installed. You must install peer dependencies yourself.
    npm WARN [email protected] requires a peer of browserslist@>= 4.21.0 but none is installed. You must install peer dependencies yourself.
    
    audited 1431 packages in 11.595s
    
    128 packages are looking for funding
      run `npm fund` for details
    
    found 14 vulnerabilities (4 moderate, 6 high, 4 critical)
      run `npm audit fix` to fix them, or `npm audit` for details
     ╭────────────────────────────────────────────────────────────────╮
       │                                                                │
       │      New major version of npm available! 6.14.17 → 8.19.2      │
       │   Changelog: https://github.com/npm/cli/releases/tag/v8.19.2   │
       │               Run npm install -g npm to update!                │
       │                                                                │
       ╰────────────────────────────────────────────────────────────────╯
    
    
    3. Checking installed plugins for updates...Checking installed plugins and themes for updates...   OK
    All packages up-to-date!
    
    4. Updating NodeBB data store schema...2022-09-19T15:50:26.848Z [4567/18808] - verbose: [minifier] utilizing a maximum of 3 additional threads
    Error occurred during upgrade: TypeError: maxAge must be a number
        at LRUCache.set (/opt/nodebb/node_modules/lru-cache/index.js:157:13)
        at Object.cache.set (/opt/nodebb/src/cache/lru.js:68:12)
        at /opt/nodebb/src/database/mongo/hash.js:138:10
        at Array.forEach (<anonymous>)
        at module.getObjectsFields (/opt/nodebb/src/database/mongo/hash.js:136:16)
        at processTicksAndRejections (internal/process/task_queues.js:95:5)
        at async module.getObjects (/opt/nodebb/src/database/mongo/hash.js:92:10)
        at async module.getObject (/opt/nodebb/src/database/mongo/hash.js:87:16)
        at async Configs.getFields (/opt/nodebb/src/meta/configs.js:111:12)
        at async Configs.list (/opt/nodebb/src/meta/configs.js:98:9)
    (node:18808) UnhandledPromiseRejectionWarning: TypeError: maxAge must be a number
        at LRUCache.set (/opt/nodebb/node_modules/lru-cache/index.js:157:13)
        at Object.cache.set (/opt/nodebb/src/cache/lru.js:68:12)
        at /opt/nodebb/src/database/mongo/hash.js:138:10
        at Array.forEach (<anonymous>)
        at module.getObjectsFields (/opt/nodebb/src/database/mongo/hash.js:136:16)
        at processTicksAndRejections (internal/process/task_queues.js:95:5)
        at async module.getObjects (/opt/nodebb/src/database/mongo/hash.js:92:10)
        at async module.getObject (/opt/nodebb/src/database/mongo/hash.js:87:16)
        at async Configs.getFields (/opt/nodebb/src/meta/configs.js:111:12)
        at async Configs.list (/opt/nodebb/src/meta/configs.js:98:9)
    (Use `node --trace-warnings ...` to show where the warning was created)
    (node:18808) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
    (node:18808) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    
    
    tail -f output.log
    Error: EACCES: permission denied, rmdir '/opt/nodebb/build/public/plugins/nodebb-plugin-emoji'
    2022-09-19T15:56:32.905Z [4567/18935] - error: admin.reload
    Error: EACCES: permission denied, rmdir '/opt/nodebb/build/public/plugins/nodebb-plugin-emoji'
    2022-09-19T15:56:32.906Z [4567/18935] - error: [build]          requirejs modules  build failed
    2022-09-19T15:56:32.940Z [4567/18935] - error: [build]                  templates  build failed
    2022-09-19T15:56:32.942Z [4567/18935] - error: [build]                  languages  build failed
    2022-09-19T15:56:39.483Z [4567/18935] - info: [build]           client js bundle  build completed in 6.677sec
    2022-09-19T15:56:39.483Z [4567/18935] - info: [build]            admin js bundle  build completed in 6.676sec
    2022-09-19T15:56:39.488Z [4567/18935] - info: [build]         client side styles  build completed in 6.681sec
    2022-09-19T15:56:40.287Z [4567/18935] - info: [build] admin control panel styles  build completed in 7.478sec
    
    
  • What does this print npm ls lru-cache?

  • @baris said in What? UnhandledPromiseRejectionWarning:

    npm ls lru-cache

    npm ls lru-cache

    [email protected] /opt/nodebb
    ├── [email protected]
    ├─┬ [email protected]
    │ ├─┬ @commitlint/[email protected]
    │ │ └─┬ @commitlint/[email protected]
    │ │ └─┬ [email protected]
    │ │ └─┬ [email protected]
    │ │ └─┬ [email protected]
    │ │ └─┬ [email protected]
    │ │ └── [email protected]
    │ └── [email protected]
    └─┬ [email protected]
    └── [email protected]

  • The log seems to show complaints about plugins and their versions too. Can't recall how I update plugins but I thought nodebb upgrade took care of that.

  • Now it's asking me to upgrade again, from 2.5.2 to 2.5.3.

  • @NodeHam Yeah the error during ./nodebb upgrade is expected, and I don't know how to condition around it. You have to run ./nodebb upgrade twice due to the lru-cache incompatibility.

    Just run ./nodebb upgrade again. You should see NodeBB Upgrade Complete centred in green at the bottom when the upgrade completes properly.

  • This post is deleted!
  • I did as you suggested.
    First I upgraded to the latest then I ran the upgrade a couple of times.

    These were some warnings.

    WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
    This can impact web performance.
    Assets:
      d9d9f5deccb1ee634fc7e944aa75df78.js (491 KiB)
      nodebb.min.js (354 KiB)
      admin.min.js (393 KiB)
      1083.54c1863fb2105af42e86.min.js (799 KiB)
      4793.2d2618b33142254453d5.min.js (454 KiB)
      8522.e860bab56ff4054cb14a.min.js (478 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 (354 KiB)
          nodebb.min.js
      admin (393 KiB)
          admin.min.js
    
    webpack 5.74.0 compiled with 2 warnings in 43547 ms
    2022-09-19T22:13:36.525Z [4567/19606] - info: [build] Asset compilation successful. Completed in 54.785sec.
    
    
  • BTW, thank you very much for your help!

  • @NodeHam Those warnings are okay 🙂 We'll try to reduce those file sizes down further over time, but they are merely warnings.

  • I have another thread going where I'm really stuck trying to rebuild the forums onto another server. I cannot find enough information to do this safely. Any chance you could look?


Suggested Topics


  • 0 Votes
    2 Posts
    22 Views

    c54b9ad4-b35c-4539-877a-9fc6a984f4ee-image.png

  • 0 Votes
    4 Posts
    52 Views

    @PitaJ I use hetzner myself as do others. Excellent host with reasonable prices and good services.

  • Import from Xenforo

    General Discussion
    5
    0 Votes
    5 Posts
    248 Views

    @gotwf how did it go? I’m considering the same thing.

    Thanks

  • 0 Votes
    10 Posts
    611 Views

    @PitaJ said in How do I upgrade NodeBB without destroying Data & images?:

    @dunlix you could lose installed plugins, but that's unlikely. You certainly wouldn't lose activated plugins.

    Did you lose uploads? What plugins did you lose?

    The only things that it can conceive of that are not in the database are uploads, which you can back up before an upgrade according to the documents you referenced.

  • 0 Votes
    10 Posts
    4k Views

    if you're trying to embed nodebb on another site (i.e., the nodebb instance domain ISN'T your website's domain), you'll have to contend with CSP headers. just a heads up.

    if you have full control of the server on which your nodebb instance is hosted, you could set up a simple reverse proxy with nginx, point it to whatever port nodebb is listening on, and set the headers to something lax that way. config below.

    server { listen localhost:4000 ssl; server_name localhost; ssl_certificate /etc/nginx/ssl/localhost.crt; ssl_certificate_key /etc/nginx/ssl/localhost.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers 'AES128+EECDH:AES128+EDH'; ssl_prefer_server_ciphers on; location /forum { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; client_max_body_size 100M; proxy_pass http://127.0.0.1:4567; proxy_redirect off; proxy_intercept_errors on; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_hide_header content-security-policy; proxy_hide_header x-frame-options; add_header content-security-policy "default-src * 'unsafe-eval' 'unsafe-inline' 'self' 'inline' 'http://*.*'"; } }

    you can append whatever domains you'd like to the 3rd to last line (the one that starts with add_header ...), though you shouldn't need to, since the * should whitelist all origins.

    you might ask, “what legitimate use would there be for this?!?”
    in my particular case, it's nice for local development — where your nodebb instance is already running elsewhere but you want to embed it in the site you're developing on your PC.