docker-nginx-proxy-manager icon indicating copy to clipboard operation
docker-nginx-proxy-manager copied to clipboard

Cannot read property 'avatar' of null

Open pavelbinar opened this issue 5 years ago • 21 comments

I sotopped seeing the Proxy Hosts settings and instead I got the:

Cannot read property 'avatar' of null

error message. I do not know how that happened, but the first guess is the automatics docker image update jlesage/nginx-proxy-manager

I am using v2.0.13

pavelbinar avatar May 27 '19 15:05 pavelbinar

Where do you get this error exactly? In the UI or the container's log? Is the UI still accessible?

jlesage avatar May 30 '19 01:05 jlesage

The error is in the GUI:

Screenshot 2019-06-04 13 50 37 Screenshot 2019-06-04 13 49 58

pavelbinar avatar Jun 04 '19 11:06 pavelbinar

How did you change your avatar? I think this is not something that can be changed via the interface.

jlesage avatar Jun 05 '19 09:06 jlesage

I did not change it nor set it up :)

I guess it uses https://en.gravatar.com/

pavelbinar avatar Jun 05 '19 14:06 pavelbinar

Yes you are right...

So what this command outputs?

docker exec <conainer name> sh -c 'echo "select email,avatar from nginxproxymanager.user" | mysql'

Do you have a null avatar?

jlesage avatar Jun 12 '19 02:06 jlesage

Here is the result of your query:

root@Xenon:~# docker exec NginxProxyManager sh -c 'echo "select email,avatar from nginxproxymanager.user" | mysql'
email	avatar
pavel@XXXX	//www.gravatar.com/avatar/13711f8a5ed4b796fe96cd42e26aca90?default=mm
pavel@XXXX	//www.gravatar.com/avatar/13711f8a5ed4b796fe96cd42e26aca90?default=mm

I modified the email to pavel@XXXX just to anonymize the data.

pavelbinar avatar Jun 12 '19 09:06 pavelbinar

Hi @jlesage ,

I am keeping the container with all my issues running so you can debug it. It do not see any progress so I will delete it and start over.

Let me know if I should wait.

Thanks.

pavelbinar avatar Jul 21 '19 19:07 pavelbinar

Sorry I didn't have time to work on this. If it's possible for you to remove any sensitive data from your config and share the appdata folder, I could use it to debug on my side. Else just start over to have something functional.

jlesage avatar Jul 23 '19 01:07 jlesage

image

TWhidden avatar Jul 20 '20 19:07 TWhidden

This also happens when you delete an user account.

DragonicDefson avatar Dec 10 '20 23:12 DragonicDefson

I had this problem when re-creating the user account due to a lost password. I had to update a few tables (proxy_host, redirection_host, audit, etc.) Once those were referencing the correct owner_user_id, the error went away (and I was able to see/edit my proxy entries).

kevinsherman avatar Feb 23 '21 03:02 kevinsherman

I had this problem when re-creating the user account due to a lost password. I had to update a few tables (proxy_host, redirection_host, audit, etc.) Once those were referencing the correct owner_user_id, the error went away (and I was able to see/edit my proxy entries).

This is the error I'm having. Tried resetting my password following the directions from #230. Now I'm receiving avatar errors like OP. Could you elaborate on the commands to update the tables? I'm not familiar with MariaDB / MySQL at all.

UPDATE: After replicating the steps from #230 again, I was able to get it to a relatively stable state. It appears that I'm going to be unable to delete old accounts until this is fixed. My last admin account was using an @icloud.com suffix which could explain the avatar issue. Setting all of the users to is_deleted=0; via UPDATE user SET is_deleted=0; will make them re-appear in the Users list and I'm able to access the Hosts list once again.

Output of: select email,avatar from user;

+--------------------+-----------------------------------------------------------------------+
| email              | avatar                                                                |
+--------------------+-----------------------------------------------------------------------+
| [email protected] | //www.gravatar.com/avatar/c203a2090b903962ae58d5fb3d3XXXXX?default=mm |
| [email protected] | //www.gravatar.com/avatar/c203a2090b903962ae58d5fb3d3XXXXX?default=mm |
| [email protected]  | //www.gravatar.com/avatar/02d753f45ef41e670c41a6a81c8XXXXX?default=mm |
| [email protected] | //www.gravatar.com/avatar/c203a2090b903962ae58d5fb3d3XXXXX?default=mm |
| [email protected] | //www.gravatar.com/avatar/c203a2090b903962ae58d5fb3d3XXXXX?default=mm |
| [email protected] | //www.gravatar.com/avatar/6257524feec9cca05f182d70169XXXXX?default=mm |
+--------------------+-----------------------------------------------------------------------+

bugs181 avatar Mar 12 '21 04:03 bugs181

I had this problem when re-creating the user account due to a lost password. I had to update a few tables (proxy_host, redirection_host, audit, etc.) Once those were referencing the correct owner_user_id, the error went away (and I was able to see/edit my proxy entries).

This is the error I'm having. Tried resetting my password following the directions from #230. Now I'm receiving avatar errors like OP. Could you elaborate on the commands to update the tables? I'm not familiar with MariaDB / MySQL at all.

UPDATE: After replicating the steps from #230 again, I was able to get it to a relatively stable state. It appears that I'm going to be unable to delete old accounts until this is fixed. My last admin account was using an @icloud.com suffix which could explain the avatar issue. Setting all of the users to is_deleted=0; via UPDATE user SET is_deleted=0; will make them re-appear in the Users list and I'm able to access the Hosts list once again.

Output of: select email,avatar from user;

+--------------------+-----------------------------------------------------------------------+
| email              | avatar                                                                |
+--------------------+-----------------------------------------------------------------------+
| [email protected] | //www.gravatar.com/avatar/c203a2090b903962ae58d5fb3d3XXXXX?default=mm |
| [email protected] | //www.gravatar.com/avatar/c203a2090b903962ae58d5fb3d3XXXXX?default=mm |
| [email protected]  | //www.gravatar.com/avatar/02d753f45ef41e670c41a6a81c8XXXXX?default=mm |
| [email protected] | //www.gravatar.com/avatar/c203a2090b903962ae58d5fb3d3XXXXX?default=mm |
| [email protected] | //www.gravatar.com/avatar/c203a2090b903962ae58d5fb3d3XXXXX?default=mm |
| [email protected] | //www.gravatar.com/avatar/6257524feec9cca05f182d70169XXXXX?default=mm |
+--------------------+-----------------------------------------------------------------------+

This also worked for me! Thanks

ChristianLempa avatar Mar 12 '21 09:03 ChristianLempa

Just ran into this after deleting a user. Have to change owner_user_id in the tables of the affected pages to an existing user. For me was access_list and proxy_host tables.

iamenderst avatar May 19 '21 17:05 iamenderst

Yes, just follow this guide and you won't have any issues https://github.com/NginxProxyManager/nginx-proxy-manager/issues/230#issuecomment-815078355

zygimantus avatar Mar 16 '22 06:03 zygimantus

Used the link @zygimantus to reset a forgotten password. Ended up with some duplicate users. When deleting those users, I get this error. I am able to change/disable accounts and everything works fine, but deleting them results in this error.

When having this issue, it's possible to 'fix' it by UPDATE user SET is_deleted=0; on the DB.

realJoshByrnes avatar Nov 24 '22 07:11 realJoshByrnes

in fact the back rest (exemple: /api/nginx/certificates?expand=owner) api return null on owner attribute if the owner of the proxy host/certificats/etc object is disabled of removed (remove by the ui)...

i think is bug on the api, i think the remove of user must reassign the object to the user who remove user.

and if the user is disabled the api must return the user information and not null.

i've reafected all my object with my news user.

to get sqlite3 cli (if the database used is sqlite) in the container (in ssh terminal addon):

# docker exec addon_<id>_nginxproxymanager /bin/sh
# apk update
# apk add sqlite

to get the user id (column id):

# sqlite3 /data/database.sqlite
sqlite> select id, email from user;
1|[email protected]
2|[email protected]

my new user is id = 2

to update proxy_host table and reaffect to the new user:

sqlite> update proxy_host set owner_user_id = 2;

and reload the proxy manager proxy host admin page.

the same for each table that have owner_user_id column.

mcarbonneaux avatar Mar 13 '23 14:03 mcarbonneaux

Hi, can add to this problem, also getting the same error on a certificate that is owned by the original admin user, which I deleted. Fixed with the same fix as above but for the certificate table:

update certificate set owner_user_id = 2;```

lebagvondouche avatar May 21 '23 16:05 lebagvondouche

Hi,

Just delete all users you don't need, then for the user you want do, UPDATE user SET id=1 WHERE id=(Current id of your User);

The issue is, that your main user with id 1 is most likely the owner and the user you want to reactivate. But because your new user does not have id 1 it will give you this error. You could update the id for all tables/entries manually. But as I'm lazy, and only have one user this is a lot quicker.

hend0012 avatar Feb 02 '24 09:02 hend0012

I got this problem after resetting my password as shown here: https://github.com/NginxProxyManager/nginx-proxy-manager/discussions/1634 (setting isDeleted to the current user, the user that created the proxy hosts)

And was able to fix it only by deleting all the contents of the data folder (docker volume)

omuleanu avatar Mar 26 '24 18:03 omuleanu

If you were playing with adding users , I had an error in the audit tab, I fixed by "delete from audit_log;" now all the tabs are working fine. and this is just FYI all the tables using the column "owner_user_id" :

  • proxy_host
  • certificate
  • access_list
  • dead_host
  • redirection_host
  • stream

naitbrahim avatar Apr 02 '24 11:04 naitbrahim