[DigitalPoint] Better Google Analytics

[DigitalPoint] Better Google Analytics 1.1.2

No permission to download
I'm running the latest version and I'm getting this error when I reply to threads... the reply goes in but the error comes up anyway.

Code:
Oops! We ran into some problems.
SodiumException: sodium_crypto_secretbox(): Argument #3 ($key) must be SODIUM_CRYPTO_SECRETBOX_KEYBYTES bytes long in src/addons/DigitalPoint/Analytics/Util/Crypt.php at line 21
[LIST=1]
[*]sodium_crypto_secretbox() in src/addons/DigitalPoint/Analytics/Util/Crypt.php at line 21
[*]DigitalPoint\Analytics\Util\Crypt::encrypt() in src/addons/DigitalPoint/Analytics/XF/Mail/Mailer.php at line 54
[*]DigitalPoint\Analytics\XF\Mail\Mailer->renderMailTemplate() in src/XF/Mail/Mail.php at line 420
[*]XF\Mail\Mail->renderTemplate() in src/XF/Mail/Mail.php at line 492
[*]XF\Mail\Mail->getSendableEmail() in src/XF/Mail/Mail.php at line 587
[*]XF\Mail\Mail->queue() in src/XF/Notifier/Post/AbstractWatch.php at line 141
[*]XF\Notifier\Post\AbstractWatch->sendEmail() in src/XF/Service/AbstractNotifier.php at line 97
[*]XF\Service\AbstractNotifier->notifyType() in src/XF/Service/AbstractNotifier.php at line 49
[*]XF\Service\AbstractNotifier->notify() in src/XF/Service/AbstractNotifier.php at line 61
[*]XF\Service\AbstractNotifier->notifyAndEnqueue() in src/XF/Service/Thread/ReplierService.php at line 262
[*]XF\Service\Thread\ReplierService->sendNotifications() in src/XF/Pub/Controller/ThreadController.php at line 505
[*]XF\Pub\Controller\ThreadController->finalizeThreadReply() in src/XF/Pub/Controller/ThreadController.php at line 664
[*]XF\Pub\Controller\ThreadController->actionAddReply() in src/XF/Mvc/Dispatcher.php at line 362
[*]XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 264
[*]XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 121
[*]XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 63
[*]XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2826
[*]XF\App->run() in src/XF.php at line 806
[*]XF::runApp() in index.php at line 23
[/LIST]
 
Looks like it's a XenForo bug with their Nestable function. See:


I still have this problem and it doesn't save my changes. Is there any solution?

1736869605143.webp
 
digitalpoint updated [DigitalPoint] Better Google Analytics with a new update entry:

Some minor things...

  • Force user_id to be integer before sending it via Measurement API (usually for things like logging emails being read).
  • Made change to Nestable usage so it works in 2.2 and 2.3 (was waiting for Nestable fix: https://xenforo.com/community/threads/nestable-not-coercing-value.225063/ )
  • Added option to reset encryption key (used for email tracking) under Admin -> Tools -> Rebuild caches
  • Fixed FontAwesome icon on button for setting Measurement ID

Read the rest of this update entry...
 
I think the problem was that I accidentally deleted the entire Analytics account instead of just deleting the Property of one of my websites.
Ya, that definitely would be a problem (trying to give yourself access to Google Analytics on a Google Account that doesn't have it). :)

I'm running the latest version and I'm getting this error when I reply to threads... the reply goes in but the error comes up anyway.

Code:
Oops! We ran into some problems.
SodiumException: sodium_crypto_secretbox(): Argument #3 ($key) must be SODIUM_CRYPTO_SECRETBOX_KEYBYTES bytes long in src/addons/DigitalPoint/Analytics/Util/Crypt.php at line 21
[LIST=1]
[*]sodium_crypto_secretbox() in src/addons/DigitalPoint/Analytics/Util/Crypt.php at line 21
[*]DigitalPoint\Analytics\Util\Crypt::encrypt() in src/addons/DigitalPoint/Analytics/XF/Mail/Mailer.php at line 54
[*]DigitalPoint\Analytics\XF\Mail\Mailer->renderMailTemplate() in src/XF/Mail/Mail.php at line 420
[*]XF\Mail\Mail->renderTemplate() in src/XF/Mail/Mail.php at line 492
[*]XF\Mail\Mail->getSendableEmail() in src/XF/Mail/Mail.php at line 587
[*]XF\Mail\Mail->queue() in src/XF/Notifier/Post/AbstractWatch.php at line 141
[*]XF\Notifier\Post\AbstractWatch->sendEmail() in src/XF/Service/AbstractNotifier.php at line 97
[*]XF\Service\AbstractNotifier->notifyType() in src/XF/Service/AbstractNotifier.php at line 49
[*]XF\Service\AbstractNotifier->notify() in src/XF/Service/AbstractNotifier.php at line 61
[*]XF\Service\AbstractNotifier->notifyAndEnqueue() in src/XF/Service/Thread/ReplierService.php at line 262
[*]XF\Service\Thread\ReplierService->sendNotifications() in src/XF/Pub/Controller/ThreadController.php at line 505
[*]XF\Pub\Controller\ThreadController->finalizeThreadReply() in src/XF/Pub/Controller/ThreadController.php at line 664
[*]XF\Pub\Controller\ThreadController->actionAddReply() in src/XF/Mvc/Dispatcher.php at line 362
[*]XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 264
[*]XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 121
[*]XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 63
[*]XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2826
[*]XF\App->run() in src/XF.php at line 806
[*]XF::runApp() in index.php at line 23
[/LIST]
So I know how this could happen in theory... if you didn't have the Sodium PHP extension installed/enabled when you installed the addon, but then later it got enabled. You would end up with the extension available for use, but without an encryption key (the encryption key is set when you install the addon). I went ahead and made an option to reset your encryption key in the admin area.

I still have this problem and it doesn't save my changes. Is there any solution?

View attachment 317394
Update to the latest version.
 
Ya, that definitely would be a problem (trying to give yourself access to Google Analytics on a Google Account that doesn't have it). :)


So I know how this could happen in theory... if you didn't have the Sodium PHP extension installed/enabled when you installed the addon, but then later it got enabled. You would end up with the extension available for use, but without an encryption key (the encryption key is set when you install the addon). I went ahead and made an option to reset your encryption key in the admin area.


Update to the latest version.

We run default centminmod installations... and it doesn't come with this library installed I don't believe. We run this on many sites, some on the same server and never seen this error before. So I don't think it is an issue with the library being installed or uninstalled... more like a bug or even a timeout issue?
 
We run default centminmod installations... and it doesn't come with this library installed I don't believe. We run this on many sites, some on the same server and never seen this error before. So I don't think it is an issue with the library being installed or uninstalled... more like a bug or even a timeout issue?
No idea what centminmod is, so can't help you there, but Sodium is installed, you wouldn't get that error if it wasn't installed. So... 🤷🏻‍♂️

That's the underlying issue... at one point Sodium wasn't installed (specifically when you installed the addon), and now it is.
 
No idea what centminmod is, so can't help you there, but Sodium is installed, you wouldn't get that error if it wasn't installed. So... 🤷🏻‍♂️

That's the underlying issue... at one point Sodium wasn't installed (specifically when you installed the addon), and now it is.

OK, I'll tie in @eva2000 and see. Maybe in one of the updates of Centminmod / Alma 9 it got removed temporarily or something. Strange.
 
We run default centminmod installations... and it doesn't come with this library installed I don't believe. We run this on many sites, some on the same server and never seen this error before. So I don't think it is an issue with the library being installed or uninstalled... more like a bug or even a timeout issue?
Centmin Mod LEMP stack installs libsodium and argon2 support for PHP out of the box default
Code:
php --ri sodium

sodium

sodium support => enabled
libsodium headers version => 1.0.20
libsodium library version => 1.0.20
Code:
php -r 'print_r(get_defined_constants());' | grep -i argon
    [PASSWORD_ARGON2I] => argon2i
    [PASSWORD_ARGON2ID] => argon2id
    [PASSWORD_ARGON2_DEFAULT_MEMORY_COST] => 65536
    [PASSWORD_ARGON2_DEFAULT_TIME_COST] => 4
    [PASSWORD_ARGON2_DEFAULT_THREADS] => 1
    [PASSWORD_ARGON2_PROVIDER] => standard
    [SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13] => 1
    [SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13] => 2
    [SODIUM_CRYPTO_PWHASH_STRPREFIX] => $argon2id$

Code:
php -r 'print_r(get_defined_constants());' | grep -i sodium
    [SODIUM_LIBRARY_VERSION] => 1.0.20
    [SODIUM_LIBRARY_MAJOR_VERSION] => 26
    [SODIUM_LIBRARY_MINOR_VERSION] => 2
    [SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES] => 32
    [SODIUM_CRYPTO_AEAD_AES256GCM_NSECBYTES] => 0
    [SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES] => 12
    [SODIUM_CRYPTO_AEAD_AES256GCM_ABYTES] => 16
    [SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES] => 32
    [SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES] => 0
    [SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES] => 8
    [SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_ABYTES] => 16
    [SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES] => 32
    [SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES] => 0
    [SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES] => 12
    [SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES] => 16
    [SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES] => 32
    [SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES] => 0
    [SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES] => 24
    [SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES] => 16
    [SODIUM_CRYPTO_AUTH_BYTES] => 32
    [SODIUM_CRYPTO_AUTH_KEYBYTES] => 32
    [SODIUM_CRYPTO_BOX_SEALBYTES] => 48
    [SODIUM_CRYPTO_BOX_SECRETKEYBYTES] => 32
    [SODIUM_CRYPTO_BOX_PUBLICKEYBYTES] => 32
    [SODIUM_CRYPTO_BOX_KEYPAIRBYTES] => 64
    [SODIUM_CRYPTO_BOX_MACBYTES] => 16
    [SODIUM_CRYPTO_BOX_NONCEBYTES] => 24
    [SODIUM_CRYPTO_BOX_SEEDBYTES] => 32
    [SODIUM_CRYPTO_KDF_BYTES_MIN] => 16
    [SODIUM_CRYPTO_KDF_BYTES_MAX] => 64
    [SODIUM_CRYPTO_KDF_CONTEXTBYTES] => 8
    [SODIUM_CRYPTO_KDF_KEYBYTES] => 32
    [SODIUM_CRYPTO_KX_SEEDBYTES] => 32
    [SODIUM_CRYPTO_KX_SESSIONKEYBYTES] => 32
    [SODIUM_CRYPTO_KX_PUBLICKEYBYTES] => 32
    [SODIUM_CRYPTO_KX_SECRETKEYBYTES] => 32
    [SODIUM_CRYPTO_KX_KEYPAIRBYTES] => 64
    [SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES] => 17
    [SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES] => 24
    [SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES] => 32
    [SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX] => 274877906816
    [SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE] => 0
    [SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH] => 1
    [SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY] => 2
    [SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL] => 3
    [SODIUM_CRYPTO_GENERICHASH_BYTES] => 32
    [SODIUM_CRYPTO_GENERICHASH_BYTES_MIN] => 16
    [SODIUM_CRYPTO_GENERICHASH_BYTES_MAX] => 64
    [SODIUM_CRYPTO_GENERICHASH_KEYBYTES] => 32
    [SODIUM_CRYPTO_GENERICHASH_KEYBYTES_MIN] => 16
    [SODIUM_CRYPTO_GENERICHASH_KEYBYTES_MAX] => 64
    [SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13] => 1
    [SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13] => 2
    [SODIUM_CRYPTO_PWHASH_ALG_DEFAULT] => 2
    [SODIUM_CRYPTO_PWHASH_SALTBYTES] => 16
    [SODIUM_CRYPTO_PWHASH_STRPREFIX] => $argon2id$
    [SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE] => 2
    [SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE] => 67108864
    [SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE] => 3
    [SODIUM_CRYPTO_PWHASH_MEMLIMIT_MODERATE] => 268435456
    [SODIUM_CRYPTO_PWHASH_OPSLIMIT_SENSITIVE] => 4
    [SODIUM_CRYPTO_PWHASH_MEMLIMIT_SENSITIVE] => 1073741824
    [SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES] => 32
    [SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX] => $7$
    [SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE] => 524288
    [SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE] => 16777216
    [SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE] => 33554432
    [SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE] => 1073741824
    [SODIUM_CRYPTO_SCALARMULT_BYTES] => 32
    [SODIUM_CRYPTO_SCALARMULT_SCALARBYTES] => 32
    [SODIUM_CRYPTO_SHORTHASH_BYTES] => 8
    [SODIUM_CRYPTO_SHORTHASH_KEYBYTES] => 16
    [SODIUM_CRYPTO_SECRETBOX_KEYBYTES] => 32
    [SODIUM_CRYPTO_SECRETBOX_MACBYTES] => 16
    [SODIUM_CRYPTO_SECRETBOX_NONCEBYTES] => 24
    [SODIUM_CRYPTO_SIGN_BYTES] => 64
    [SODIUM_CRYPTO_SIGN_SEEDBYTES] => 32
    [SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES] => 32
    [SODIUM_CRYPTO_SIGN_SECRETKEYBYTES] => 64
    [SODIUM_CRYPTO_SIGN_KEYPAIRBYTES] => 96
    [SODIUM_CRYPTO_STREAM_NONCEBYTES] => 24
    [SODIUM_CRYPTO_STREAM_KEYBYTES] => 32
    [SODIUM_CRYPTO_STREAM_XCHACHA20_NONCEBYTES] => 24
    [SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES] => 32
    [SODIUM_BASE64_VARIANT_ORIGINAL] => 1
    [SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING] => 3
    [SODIUM_BASE64_VARIANT_URLSAFE] => 5
    [SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING] => 7
    [SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_BYTES] => 32
    [SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES] => 32
    [SODIUM_CRYPTO_CORE_RISTRETTO255_BYTES] => 32
    [SODIUM_CRYPTO_CORE_RISTRETTO255_HASHBYTES] => 64
    [SODIUM_CRYPTO_CORE_RISTRETTO255_SCALARBYTES] => 32
    [SODIUM_CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES] => 64

Code:
php -v
PHP 8.3.15 (cli) (built: Jan 12 2025 00:10:06) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.15, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.15, Copyright (c), by Zend Technologies
But you need to enable such in Xenforo config.php
 
Last edited:
I get this error trying to set up theaddon with my mobile phone:


InvalidArgumentException: Missing OAuth2 token. in src/addons/DigitalPoint/Analytics/GoogleApi/AbstractApi.php at line 43

DigitalPoint\Analytics\GoogleApi\AbstractApi->getToken() in src/addons/DigitalPoint/Analytics/GoogleApi/AbstractApi.php at line 11
DigitalPoint\Analytics\GoogleApi\AbstractApi->makeApiCall() in src/addons/DigitalPoint/Analytics/GoogleApi/Admin.php at line 14
DigitalPoint\Analytics\GoogleApi\Admin->accountSummariesList() in src/addons/DigitalPoint/Analytics/Repository/Reporting.php at line 11
DigitalPoint\Analytics\Repository\Reporting->getAccountSummaries() in src/addons/DigitalPoint/Analytics/XF/Admin/Controller/Option.php at line 111
DigitalPoint\Analytics\XF\Admin\Controller\Option->actionGoogleAnalyticsSelect() in src/XF/Mvc/Dispatcher.php at line 362
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 264
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 121
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 63
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2826
XF\App->run() in src/XF.php at line 806
XF::runApp() in admin.php at line 15
Yeah I just picked this up (on my laptop) and up to date but I did update earlier today to 1.1.2.
 
Buuuut,... I just fixed it. For some reason I had to redo the google analytics measurement ID number. And I verified by hitting the spots in acp that was generating errors but this fixed it and cleared them..
 
Yah, I'm getting errors as well. Got it again on a site when posting a new thread today... the site wouldn't allow the thread to be posted.

Code:
Server error log
[LIST]
[*]SodiumException: sodium_crypto_secretbox(): Argument #3 ($key) must be SODIUM_CRYPTO_SECRETBOX_KEYBYTES bytes long
[*]src/addons/DigitalPoint/Analytics/Util/Crypt.php:21
[*]Generated by: supersix
[*]Jan 22, 2025 at 2:59 PM
[/LIST]
[HEADING=2]Stack trace[/HEADING]
#0 src/addons/DigitalPoint/Analytics/Util/Crypt.php(21): sodium_crypto_secretbox()
#1 src/addons/DigitalPoint/Analytics/XF/Mail/Mailer.php(54): DigitalPoint\Analytics\Util\Crypt::encrypt()
#2 src/XF/Mail/Mail.php(420): DigitalPoint\Analytics\XF\Mail\Mailer->renderMailTemplate()
#3 src/XF/Mail/Mail.php(492): XF\Mail\Mail->renderTemplate()
#4 src/XF/Mail/Mail.php(587): XF\Mail\Mail->getSendableEmail()
#5 src/XF/Notifier/Post/AbstractWatch.php(141): XF\Mail\Mail->queue()
#6 src/XF/Service/AbstractNotifier.php(97): XF\Notifier\Post\AbstractWatch->sendEmail()
#7 src/XF/Service/AbstractNotifier.php(49): XF\Service\AbstractNotifier->notifyType()
#8 src/XF/Service/AbstractNotifier.php(61): XF\Service\AbstractNotifier->notify()
#9 src/XF/Service/Thread/ReplierService.php(262): XF\Service\AbstractNotifier->notifyAndEnqueue()
#10 src/XF/Pub/Controller/ThreadController.php(505): XF\Service\Thread\ReplierService->sendNotifications()
#11 src/XF/Pub/Controller/ThreadController.php(664): XF\Pub\Controller\ThreadController->finalizeThreadReply()
#12 src/XF/Mvc/Dispatcher.php(362): XF\Pub\Controller\ThreadController->actionAddReply()
#13 src/XF/Mvc/Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass()
#14 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch()
#15 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop()
#16 src/XF/App.php(2826): XF\Mvc\Dispatcher->run()
#17 src/XF.php(806): XF\App->run()
#18 index.php(23): XF::runApp()
#19 {main}
[HEADING=2]Request state[/HEADING]
array(4) {
  ["url"] => string(73) "/threads/post-your-favorite-2026-honda-prelude-photo-or-video.7/add-reply"
  ["referrer"] => string(89) "https://www.6gprelude.com/threads/post-your-favorite-2026-honda-prelude-photo-or-video.7/"
  ["_GET"] => array(1) {
    ["/threads/post-your-favorite-2026-honda-prelude-photo-or-video_7/add-reply"] => string(0) ""
  }
  ["_POST"] => array(11) {
    ["_xfToken"] => string(8) "********"
    ["message_html"] => string(333) "<p>I'm probably 10% of the views on this video.. <img class="smilie smilie--emoji fr-fic fr-dii" alt="🤣" title="Rolling on the floor laughing    :rofl:" src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f923.png" data-shortname=":rofl:">3</p><p><br></p><p>https://www.youtube.com/shorts/-L660BvNoTQ</p><p><br></p>"
    ["attachment_hash"] => string(32) "6cc836dc9e125b4d34c822d7f7cc8b4c"
    ["attachment_hash_combined"] => string(83) "{"type":"post","context":{"thread_id":7},"hash":"6cc836dc9e125b4d34c822d7f7cc8b4c"}"
    ["last_date"] => string(10) "1734725683"
    ["last_known_date"] => string(10) "1734725683"
    ["parent_id"] => string(2) "25"
    ["load_extra"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
    ["_xfWithData"] => string(1) "1"
    ["_xfRequestUri"] => string(64) "/threads/post-your-favorite-2026-honda-prelude-photo-or-video.7/"
  }
}
Is there anything that could be causing this on sites that don't get a lot of traffic or don't refresh something every so often? Because this site doesn't get a lot of traffic to potentially run cron jobs maybe?

This site hasn't had libsodium removed ever, and it was there upon installation of the add-on... something is breaking it randomly.
 
Yah, I'm getting errors as well. Got it again on a site when posting a new thread today... the site wouldn't allow the thread to be posted.

Code:
Server error log
[LIST]
[*]SodiumException: sodium_crypto_secretbox(): Argument #3 ($key) must be SODIUM_CRYPTO_SECRETBOX_KEYBYTES bytes long
[*]src/addons/DigitalPoint/Analytics/Util/Crypt.php:21
[*]Generated by: supersix
[*]Jan 22, 2025 at 2:59 PM
[/LIST]
[HEADING=2]Stack trace[/HEADING]
#0 src/addons/DigitalPoint/Analytics/Util/Crypt.php(21): sodium_crypto_secretbox()
#1 src/addons/DigitalPoint/Analytics/XF/Mail/Mailer.php(54): DigitalPoint\Analytics\Util\Crypt::encrypt()
#2 src/XF/Mail/Mail.php(420): DigitalPoint\Analytics\XF\Mail\Mailer->renderMailTemplate()
#3 src/XF/Mail/Mail.php(492): XF\Mail\Mail->renderTemplate()
#4 src/XF/Mail/Mail.php(587): XF\Mail\Mail->getSendableEmail()
#5 src/XF/Notifier/Post/AbstractWatch.php(141): XF\Mail\Mail->queue()
#6 src/XF/Service/AbstractNotifier.php(97): XF\Notifier\Post\AbstractWatch->sendEmail()
#7 src/XF/Service/AbstractNotifier.php(49): XF\Service\AbstractNotifier->notifyType()
#8 src/XF/Service/AbstractNotifier.php(61): XF\Service\AbstractNotifier->notify()
#9 src/XF/Service/Thread/ReplierService.php(262): XF\Service\AbstractNotifier->notifyAndEnqueue()
#10 src/XF/Pub/Controller/ThreadController.php(505): XF\Service\Thread\ReplierService->sendNotifications()
#11 src/XF/Pub/Controller/ThreadController.php(664): XF\Pub\Controller\ThreadController->finalizeThreadReply()
#12 src/XF/Mvc/Dispatcher.php(362): XF\Pub\Controller\ThreadController->actionAddReply()
#13 src/XF/Mvc/Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass()
#14 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch()
#15 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop()
#16 src/XF/App.php(2826): XF\Mvc\Dispatcher->run()
#17 src/XF.php(806): XF\App->run()
#18 index.php(23): XF::runApp()
#19 {main}
[HEADING=2]Request state[/HEADING]
array(4) {
  ["url"] => string(73) "/threads/post-your-favorite-2026-honda-prelude-photo-or-video.7/add-reply"
  ["referrer"] => string(89) "https://www.6gprelude.com/threads/post-your-favorite-2026-honda-prelude-photo-or-video.7/"
  ["_GET"] => array(1) {
    ["/threads/post-your-favorite-2026-honda-prelude-photo-or-video_7/add-reply"] => string(0) ""
  }
  ["_POST"] => array(11) {
    ["_xfToken"] => string(8) "********"
    ["message_html"] => string(333) "<p>I'm probably 10% of the views on this video.. <img class="smilie smilie--emoji fr-fic fr-dii" alt="🤣" title="Rolling on the floor laughing    :rofl:" src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f923.png" data-shortname=":rofl:">3</p><p><br></p><p>https://www.youtube.com/shorts/-L660BvNoTQ</p><p><br></p>"
    ["attachment_hash"] => string(32) "6cc836dc9e125b4d34c822d7f7cc8b4c"
    ["attachment_hash_combined"] => string(83) "{"type":"post","context":{"thread_id":7},"hash":"6cc836dc9e125b4d34c822d7f7cc8b4c"}"
    ["last_date"] => string(10) "1734725683"
    ["last_known_date"] => string(10) "1734725683"
    ["parent_id"] => string(2) "25"
    ["load_extra"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
    ["_xfWithData"] => string(1) "1"
    ["_xfRequestUri"] => string(64) "/threads/post-your-favorite-2026-honda-prelude-photo-or-video.7/"
  }
}
Is there anything that could be causing this on sites that don't get a lot of traffic or don't refresh something every so often? Because this site doesn't get a lot of traffic to potentially run cron jobs maybe?

This site hasn't had libsodium removed ever, and it was there upon installation of the add-on... something is breaking it randomly.
If your site is somehow losing some settings (maybe a backup restore or something), it could be a problem. Long story short is the encryption key needs to be SODIUM_CRYPTO_SECRETBOX_KEYBYTES in length (which is 32 bytes normally). So if the option storing somehow ends up with a value that isn't exactly 32 bytes in length (including it being empty) you would get that error.

The "how" or "why" the option is being changed possibly, I couldn't tell you. The addon only writes that option when it's installed or with the new thing to recreate it. And even then it's always 32 bytes. There's nothing preventing someone/some thing from editing options directly in the table or via custom code though.
 
If your site is somehow losing some settings (maybe a backup restore or something), it could be a problem. Long story short is the encryption key needs to be SODIUM_CRYPTO_SECRETBOX_KEYBYTES in length (which is 32 bytes normally). So if the option storing somehow ends up with a value that isn't exactly 32 bytes in length (including it being empty) you would get that error.

The "how" or "why" the option is being changed possibly, I couldn't tell you. The addon only writes that option when it's installed or with the new thing to recreate it. And even then it's always 32 bytes. There's nothing preventing someone/some thing from editing options directly in the table or via custom code though.

None of those things should be happening. It's dedicated hosting that I have control over... we do nightly backups but we do that on all the databases. Haven't noticed anything else breaking or being wonky... no data loss. This came out of the blue, can't think of anything that's changed really.
 
None of those things should be happening. It's dedicated hosting that I have control over... we do nightly backups but we do that on all the databases. Haven't noticed anything else breaking or being wonky... no data loss. This came out of the blue, can't think of anything that's changed really.
Well, you could query the database and first see if the record/value is in there.

SQL:
SELECT * FROM xf_option WHERE option_id = 'baAnalyticsKey';

If the record that's returned has an option_value that's 32 bytes long, you are good as far as that goes. If it's not there or not 32 bytes, you need to figure out why that database record was edit/deleted. If it's there and 32 bytes, maybe some caching layer you are using (like memcached or Reddis) is mucking what XenForo is getting back from it somehow.
 
Well, you could query the database and first see if the record/value is in there.

SQL:
SELECT * FROM xf_option WHERE option_id = 'baAnalyticsKey';

If the record that's returned has an option_value that's 32 bytes long, you are good as far as that goes. If it's not there or not 32 bytes, you need to figure out why that database record was edit/deleted. If it's there and 32 bytes, maybe some caching layer you are using (like memcached or Reddis) is mucking what XenForo is getting back from it somehow.

Code:
MariaDB [6gprelude]> SELECT * FROM xf_option WHERE option_id = 'baAnalyticsKey';
+----------------+--------------+---------------+-------------+----------------------------+-----------+-------------+------------------+-------------------+----------+------------------------+
| option_id      | option_value | default_value | edit_format | edit_format_params         | data_type | sub_options | validation_class | validation_method | advanced | addon_id               |
+----------------+--------------+---------------+-------------+----------------------------+-----------+-------------+------------------+-------------------+----------+------------------------+
| baAnalyticsKey |              |               | template    | option_template_uneditable | string    |             |                  |                   |        0 | DigitalPoint/Analytics |
+----------------+--------------+---------------+-------------+----------------------------+-----------+-------------+------------------+-------------------+----------+------------------------+
1 row in set (0.002 sec)

We do run memcache configs on this server and we have multiple databases using it as well that are also xenforo and live and haven't run into this issue with them. I checked the memcache config on all the sites and the namespace is all different/correct on the configs. I'll disable it on this site just to test.

I see the key is empty. The site is working though and I'm able to post a thread without error... the Options page for Better Analytics looks normal and fine. I don't see anywhere to generate a new 'key'
 
Well I'm 100% certain there is nothing in the addon that would ever write any value to that option other than a 32-byte string. So if it's being erased somehow, it's something outside the addon.

Just to make sure there's not some random debugging code left in there, I grepped every occurrence of baAnalyticsKey in the code, and it's all as expected.

Bash:
twin1:/home/sites/sexytime.site/web/src/addons/DigitalPoint/Analytics # grep -R baAnalyticsKey *
Setup.php:                        if (function_exists('sodium_crypto_secretbox') && strlen(\XF::options()->baAnalyticsKey) != SODIUM_CRYPTO_SECRETBOX_KEYBYTES)
Setup.php:                        \XF::repository('XF:Option')->updateOption('baAnalyticsKey', \XF::generateRandomString(SODIUM_CRYPTO_SECRETBOX_KEYBYTES));
Util/Crypt.php:                   return \XF::options()->baAnalyticsKey;
XF/Admin/Controller/Tools.php:    \XF::repository('XF:Option')->updateOption('baAnalyticsKey', \XF::generateRandomString(SODIUM_CRYPTO_SECRETBOX_KEYBYTES));

In the Setup.php file, during installation it checks if Sodium is installed and that the option is not 32 bytes, and if Sodium is installed and the option isn't a 32-byte string, it writes a 32-byte string.

In the Util/Crypt.php file, it reads the option for using it to encrypt something (what's causing your problem since there's no string there).

The XF/Admin/Controller/Tools.php file will write a 32-byte string to the option when you ask it to generate a new string.

...and that's it. It's really not a lot of convoluted usage of the option that could get mixed up somewhere.

There is nothing in the addon that would ever erase the option value (the only 2 uses of updateOption() is when it clearly is writing a randomly generated 32-byte string when it's supposed to... during install or on request to reset it).

That being said, it's not a "read-only" database record or option (that's not a thing in XenForo). So anything with write access to your MySQL database could in theory change that value... so that could be any process doing anything with MySQL or some other addon (not sure what it would be, just saying it's a possibility).
 
Back
Top Bottom