Cake Exception: "Argument 1 passed to App\View\Helper\AvatarHelper::getAvatarUrl() must be an instance of App\Model\Entity\Avatar, null given..."

Checklist

[X] I have read intro post: About the Installation Issues category
[X] I have read the tutorials, help and searched for similar issues
[X] I provide relevant information about my server (component names and versions, etc.)
[X] I provide a copy of my logs and healthcheck
[X] I describe the steps I have taken to trouble shoot the problem
[X] I describe the steps on how to reproduce the issue

Hi there,

Running an Ubuntu Server 18.04.04 LTS virtual machine in an business environment (no internet connection). 8 cores and 128GB internal memory and 4TB internal storage as an Docker host.
Docker version 20.10, build 7287ab3.
Docker-compose version 1.27.4, build 40524192.
Passbolt Docker image: passbolt/passbolt:latest IMAGE ID: fd6c9a69bb73.

Sending e-mails seems to be working fine but running ./bin/cake EmailQueue.preview gives an exception within the container:

Exception: Argument 1 passed to App\View\Helper\AvatarHelper::getAvatarUrl() must be an instance of App\Model\Entity\Avatar, null given, called in /var/www/passbolt/src/Template/Email/html/AN/user_register_admin.ctp on line 26 in [/var/www/passbolt/src/View/Helper/AvatarHelper.php, line 16]

Healthcheck:

www-data@PRIVATE:/var/www/passbolt$ ./bin/cake passbolt healthcheck

     ____                  __          ____
    / __ \____  _____ ____/ /_  ____  / / /_
   / /_/ / __ `/ ___/ ___/ __ \/ __ \/ / __/
  / ____/ /_/ (__  |__  ) /_/ / /_/ / / /
 /_/    \__,_/____/____/_.___/\____/_/\__/

 Open source password manager for teams
---------------------------------------------------------------
 Healthcheck shell
---------------------------------------------------------------

 Environment

 [PASS] PHP version 7.3.24.
 [PASS] PCRE compiled with unicode support.
 [PASS] The temporary directory and its content are writable.
 [PASS] The public image directory and its content are writable.
 [PASS] The logs directory and its content are writable.
 [PASS] GD or Imagick extension is installed.
 [PASS] Intl extension is installed.
 [PASS] Mbstring extension is installed.

 Config files

 [PASS] The application config file is present
 [WARN] The passbolt config file is missing in /var/www/passbolt/config/
  [HELP] Copy /var/www/passbolt/config/passbolt.php.default to /var/www/passbolt/config/passbolt.php
  [HELP] The passbolt config file is not required if passbolt is configured with environment variables

 Core config

 [PASS] Debug mode is off.
 [PASS] Cache is working.
 [PASS] Unique value set for security.salt
 [PASS] Full base url is set to https://PRIVATE:4430
 [PASS] App.fullBaseUrl validation OK.
 [PASS] /healthcheck/status is reachable.

 SSL Certificate

 [PASS] SSL peer certificate validates
 [PASS] Hostname is matching in SSL certificate.
 [PASS] Not using a self-signed certificate

 Database

 [PASS] The application is able to connect to the database
 [PASS] 23 tables found
 [PASS] Some default content is present
 [PASS] The database schema up to date.

 GPG Configuration

 [PASS] PHP GPG Module is installed and loaded.
 [PASS] The environment variable GNUPGHOME is set to /home/www-data/.gnupg.
 [PASS] The directory /home/www-data/.gnupg containing the keyring is writable by the webserver user.
 [PASS] The server gpg key is not the default one
 [PASS] The public key file is defined in config/passbolt.php and readable.
 [PASS] The private key file is defined in config/passbolt.php and readable.
 [PASS] The server key fingerprint matches the one defined in config/passbolt.php.
 [PASS] The server public key defined in the config/passbolt.php (or environment variables) is in the keyring.
 [PASS] There is a valid email id defined for the server key.
 [PASS] The public key can be used to encrypt a message.
 [PASS] The private key can be used to sign a message.
 [PASS] The public and private keys can be used to encrypt and sign a message.
 [PASS] The private key can be used to decrypt a message.
 [PASS] The private key can be used to decrypt and verify a message.
 [PASS] The public key can be used to verify a signature.

 Application configuration

 [FAIL] Could not connect to passbolt repository to check versions. It is not possible check if your version is up to date.
  [HELP] Check the network configuration to allow this script to check for updates.
 [PASS] Passbolt is configured to force SSL use.
 [PASS] App.fullBaseUrl is set to HTTPS.
 [PASS] Selenium API endpoints are disabled.
 [PASS] Search engine robots are told not to index content.
 [PASS] Registration is closed, only administrators can add users.
 [PASS] Serving the compiled version of the javascript app
 [PASS] All email notifications will be sent.

  1 error(s) found. Hang in there!

Steps to troubleshoot the problem were solving a couple of healthcheck issues untill all were fixed. Passbolt is running on an internal network so version check fail is obvious.

I have no idea on how to debug this even further. Suggestions appreciated.

Tnx,

Rodger

Hi @rodgermoore

Thanks for posting and welcome to the forum!

Would you mind verifying you can access your user’s avatar directly via url:
https[:]//PRIVATE:4430/img/avatar/user.png

From within the GUI you can right-click on the Profile avatar and get the image link. It will be different than what I show above.

Thanks for the quick reply. Via the webinterface I am able to access the avatar (after login). I forgot to mention the logs:

root@PRIVATE:/var/www/passbolt# cat /var/www/passbolt/logs/cli-debug.log
2021-01-04 15:50:05 Debug: command 'preview' in plugin 'EmailQueue' was not aliased, conflicts with 'Passbolt/EmailDigest'
2021-01-04 15:50:05 Debug: command 'sender' in plugin 'EmailQueue' was not aliased, conflicts with 'Passbolt/EmailDigest'

root@PRIVATE:/var/www/passbolt# cat /var/www/passbolt/logs/error.log
2021-01-04 15:53:51 Error: [Cake\Http\Exception\ForbiddenException] You need to login to access this location. (/var/www/passbolt/src/Auth/GpgAuthenticate.php:85)
Request URL: /users/me.json?api-version=2

Any clues?

@rodgermoore

The avatar file should be accessible even when not logged in to Passbolt.

Is this a fresh install or upgrade from previous version?

What versions are showing in the lower right hand corner of GUI when you hover over the heart?

This is common and occurs normally.

So an update.

Sending e-mails seems to be working fine but running:
$ ./bin/cake EmailQueue.preview
gives an exception within the container.

This is not true, e-mails are not being sent. To answer your questions @garrett:

The avatar file should be accessible even when not logged in to Passbolt.

True. The file is accessible even when not logged in to Passbolt. This also works fine from within the container:

$ docker exec -ti passbolt /bin/bash 
$ curl https://PRIVATE:4430/img/avatar/user.png --output user.png
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1549  100  1549    0     0   189k      0 --:--:-- --:--:-- --:--:--  189k

Is this a fresh install or upgrade from previous version?

Upgrade from previous version but because I use “latest:latest” tag for the Docker image I don’t know the previous version, oops!

What versions are showing in the lower right hand corner of GUI when you hover over the heart?

2.13.5 / 2.12.0

Thanks again for your time and help.

@rodgermoore Ok, so if the email is not actually sending this is probably good news because that’s possibly easier to resolve. I would first recommend looking at Passbolt Help | Why are my emails not being sent?

For Docker we’re working with variables so if are willing to provide to some idea regarding what your settings are, that will help. In the link above there is an email test command - what are your results with this? And check logs for any new errors along the way.